Friday, January 02, 2009

Program to find prime number

Buzz It
/*Program to find prime number*/

//
#include
#include
void main()
{
int n,i,p;
clrscr();
printf("Enter the number \n");
scanf("%d",&n);
if(n==2)
printf("The number is a prime");
else
{
for(i=2;i {
p=n%i;
if(p==0)
{
printf("The number is prine");
break;
}
}
if(p!=0)
printf("number is not prime");
}
getch();
}

-->

0 comments:

Post a Comment