Here you will get program for prime number in C.

A number that is only divisible by 1 or itself is called prime number.

For example, 17 is prime, 6 is not prime, etc.

## Program for Prime Number in C

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#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**

*Enter any number:15*

*The given number is not prime*