Thursday, July 28, 2011

Prime Number

#include<stdio.h>
void main()

{
int i,n;
clrscr();
printf("Enter an integer number : ");
scanf("%d",&n);
for(i=2;i<=n/2;i++)
  if(n%i==0)
    {
    printf("\nIt is not a prime number");
    getch();
    exit(0);
    }
printf("\nIt is a prime number");
getch();
}

0 comments:

Post a Comment