#include main() { int num; printf("Enter your number\n"); scanf("%d",&n); int i=0; int temp = 1; for(i=2;i<num;i++) // check num is prime or not { if(num%i==0) { temp =0; break; }
}
if(temp==1) { printf("%d is prime number ",num); } else { printf("%d is not prime number ",num); }
// prime number program
ReplyDelete#include
main()
{
int num;
printf("Enter your number\n");
scanf("%d",&n);
int i=0;
int temp = 1;
for(i=2;i<num;i++) // check num is prime or not
{
if(num%i==0)
{
temp =0;
break;
}
}
if(temp==1)
{
printf("%d is prime number ",num);
}
else
{
printf("%d is not prime number ",num);
}
}