#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{ int num,i;
clrscr();
printf("Enter Number: ");
scanf("%d",&num);
if(num==1)
{printf("It Is Not A Prime Number");
exit(0);}
for(i=2;i<=((num/2)+1);i++)
{ if(num%i==0)
{ printf("It Is Not A Prime Number");
break;}
else if(i==(num/2)+1)
printf("It Is A Prime Number");
}
getch();
}
No comments:
Post a Comment