Find Prime Number in C

studypoint
By -
0

#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();
 }

Post a Comment

0 Comments

Please Select Embedded Mode To show the Comment System.*

3/related/default