Prime Number in C :

- It should be greater than 1
- A number is prime if its only divisors are 1 and itself
- All non-prime numbers less than 100 will have a divisor between 2 and 10.

## Prime Number Program in C

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <stdio.h> int main() { int n,i,flag=1; printf("Enter any number:"); scanf("%d",&n); for(i=2;i< n/2;++i) if(n%i==0) { flag=0; break; } if(flag==1) printf("\nThe given number is prime"); else printf("\nThe given number is not prime"); return 0; } |

**OUTPUT for Prime Number Program in C **

You can learn about C Program to print prime numbers from 1 to n here and for quires go to quora

## 1 thought on “C Program for Prime Number”

Comments are closed.