Programmer ::fizmhd(MEA) www.mdown.co.cc*/
#include
int prime_or_not(int);
int main()
{
int number,re;
printf("Enter the number : ");
scanf("%d",&number);
re=prime_or_not(number);
if(re==1)
printf("%d is not Prime\n",number);
else if(re==0)
printf("%d is Prime\n",number);
else
printf("It is neither prime nor composite\n");
}
int prime_or_not(int num)
{
int i;
if(num==0)
return 1;
if(num==1)
return -1;
for(i=2;ilt;=num/2;i++)
{
if(num%i==0)
return 1;
}
return 0;
}
No comments:
Post a Comment