Breaking News

Find Prime Number in C


#include<stdio.h>
 #include<conio.h>
 void main()
 {

 int i=2,n;
clrscr();
 printf("enter the  num    ");
 scanf("%d",&amp;n);
 while(i&lt;=n/2)
 {
 if(n%i==0)
 {
 printf("num is not prim");
 getch();
 exit(0);
 }
 i++;
 }

 printf("num is prim");
 getch();
 }

No comments