Subscribe to Feeds

Send Your Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Check For Prime No

Click Here To Download C File Of This Program

 //Check For Prime  
//Downloaded from www.c4cprog.co.nr
#include<conio.h>
void main()
{
int n,i,p=0;
clrscr();
printf("Enter No :");
scanf("%d",&n);
if(n==1)
printf("\n Neither Prime Nor Composite");
else
{
for(i=2;i<=n/2;i++)
{
if((n%i)==0)
p++;
}
if(p==0)
printf("\n\n\t\tNO. IS PRIME");
if(p!=0)
printf("\n\n\t\tNO. IS NOT PRIME");
}
getch();
}

0 comments:

Post a Comment