computing-fundamentals
C programs and question bank.
Wednesday, October 27, 2010
prime num-c
void main()
{
int n,i,count=0;
printf("enter a num");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
{
count=count+1;
}
}
if(count<=2)
{
printf("it is prime number");
}
else
{
printf("it is not prime number");
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment