WAP TO FIND THAT NUMBER IS PRIME OR NOT

Thursday, July 2, 2009 Leave a Comment


#include<stdio.h>
#include<conio.h>
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 ();
}

OUTPUT
Enter Number: 11
Number is Prime

Enter Number: 6
Number is not  Prime

Related Posts :



0 comments »

Leave your response!