Tuesday, August 28, 2007

PRIME NUMBER

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