Find Prime Number in C
#include<stdio.h> #include<conio.h> void main() { int i=2,n; clrscr(); printf("enter the num "); scanf("%d",&n); while(i<=n/2) { if(n%i==0) { printf("num is not prim"); getch(); exit(0); } i++; } printf("num is prim"); getch(); }
No comments
Post a Comment