Showing posts with label WAP to find that number is prime or not. Show all posts
Showing posts with label WAP to find that number is prime or not. Show all posts

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 ();

}





Labels