#include<stdio.h>
main()
{
int n,i,r,f=0;
printf("Enter a number\n");
scanf("%d",&n);
if(n==1)
printf("1 is neither prime nor composite\n");
else
{
for(i=2;i<n;i++)
{
r=n%i;
if(r==0)
{
f=1;
break;
}
else
f=0;
}
if(f==0)
printf("It is a prime number\n");
else
printf("It is not a prime number\n");
}
}
main()
{
int n,i,r,f=0;
printf("Enter a number\n");
scanf("%d",&n);
if(n==1)
printf("1 is neither prime nor composite\n");
else
{
for(i=2;i<n;i++)
{
r=n%i;
if(r==0)
{
f=1;
break;
}
else
f=0;
}
if(f==0)
printf("It is a prime number\n");
else
printf("It is not a prime number\n");
}
}
You Like It!? Then kindly share with your Friends.