# Check whether the given number is prime or not using C

## Given number is prime or not using c

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/*WAP to check whether the given number is prime or not*/ #include<stdio.h> void main() { int n,i; clrscr(); printf("Enter A Integer Number-\n"); scanf("%d",&n); for(i=2;i<n;i++) { if(n%i==0) { printf("The Number %d is Not a Prime Number\n",n); break; } } if(i==n) printf("The Number %d is Prime Number\n",n); getch(); } |

## Output

1 2 3 |
Enter A Integer Number- 5 The Number 5 is Prime Number |

Comments are closed, but trackbacks and pingbacks are open.