array of all prime numbers in c code example
Example 1: prime numbers in c
#include
main() {
int n, i, count=0;
printf("Enter Number");
scanf("%d",&n);
for ( i = 1; i<= n; i++) {
if (n % i == 1) {
count++;
}
}
if( count == 2) {
printf("Prime Number");
}
else {
printf("Not A Prime Number");
}
}
Example 2: c program array prime number
100 - Not Prime
200 - Not Prime
31 - Prime
13 - Prime
97 - Prime
10 - Not Prime
20 - Not Prime
11 - Prime