c program to find prime number

**.**In this C program, we will input the number when program runs and find whether that entered**number is prime or not**. You can also refer for co- prime number.**This program uses “%” or “modulus”**operator which gives the remainder of two numbers when it is divided. We can also find prime number using recursion.For example :

**7 % 2 = 1**, as 1 is remainder when 7 is divided by 2. So if the number is not**prime number**then its**%**operation will give output ’0′ otherwise it is prime number.## c program to find prime number

#include<stdio.h> // Including library #include<conio.h> int main() { int n; int i; printf(" enter the number : "); //taking numbers scanf("%d",&n); for(i=2; i<n; i++) { if(n%i==0) //condition for prime number { printf("%d is not a prime number.", n); getch(); // hold the screen to display the above message return (1); // return statement will return the value } } printf("%d is a prime number.", n); //printing the result getch(); }

Lets see the output c program to find prime number.