#include<stdio.h>
#include<math.h>
void
main()
{
int num,i,is_prime=0;
clrscr();
printf(" Give a number : ");
scanf("%d",&num);
for (i=2;i<=sqrt(num);i++)
{
if (num%i==0)
{
is_prime=1;
break;
}
}
if (is_prime==1)
printf(" Not prime number");
else
printf(" Prime number");
getch();
}
No comments:
Post a Comment