Wednesday 30 January 2013

WAP TO FIND THAT NUMBER IS PRIME OR NOT (7,11,13,17,19 ETC.)



void main ()
{
int no,i=2;
clrscr ();
printf ("Enter Number: ");
scanf ("%d",&no);
while (i<=no)
{
if (no%i==0)
break;
i++;
}
if (i==no)
printf ("Number is Prime");
else
printf ("Number is not Prime");
getch ();
}

No comments:

Post a Comment

Comment