// Example program to check if a number is a prime number // #include int main() { int N, n, flag = 0; printf("Enter a positive integer: "); scanf("%d",&N); for(n=2; n<=N/2; ++n) { // condition for nonprime number if( N % n == 0 ) { flag=1; break; } } if (flag==0) printf("%d is a prime number.",N); else printf("%d is not a prime number.",N); return 0; }