A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
#include
#include
void main()
{
int i,n,r=0;
clrscr();
printf(“Enter any no: ”);
scanf(“%d”,&n);
for(i=2;i<=n-1;i++)
{
if(n%i==0)
r=1;
break;
}
if(r==0)
printf(“prime no”);
else
printf(“Not prime”);
getch();
}
**************************
Output:
Enter any no: 16
Not prime
***************************