Saturday, 1 October 2011

Prime Number

#include<stdio.h>
#include<conio.h>
int main()
{
int s,num,count=0;
printf("Enter a number=");
scanf("%d",&num);
for(s=2;s<num/2;s++)
{
if(num%s==0)
count++;
}
if(count>0)
printf("\n%d not prime number",num);
else
printf("\n%d prime number",num);
getch();
return 0;
}

No comments:

Post a Comment