Wednesday, July 20, 2011

Program to check prime

/*Serial No.53     [swami25.cpp]*/

#include<stdio.h>
#include<conio.h>
void main()
{
int a=2,b;
clrscr();
printf("Enter the number==>");
scanf("%d",&b);
while(a<b)
{
if(b%a==0)
break;
a=a+1;
}
if(b==a)
printf("Number is Prime");
else
printf("Not Prime Number");
getch();
}

No comments:

Post a Comment

If you have any doubt, feel free to ask...