Saturday, April 11, 2009

PROG:- Print Prime no.s-

#include
#include
void main()
{
int a,c1=0,c2;
clrscr();
printf("choose a no.");
scanf("%d",&a);
for(c2=1;c2<=a;c2++)
{
if (a%c2==0)
{
c1++;
}
if(c1!=2)
{
printf("%d is a prime no.",a);
}
else
{
printf("%d is not a prime no.",a);
}

}
getch();
}

No comments:

Post a Comment

Search This Blog