Showing posts with label Program to check prime. Show all posts
Showing posts with label Program to check prime. Show all posts

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