Saturday, 26 September 2015

Program to find enter number prime or not

/*Program to find enter number prime or not*/
#include<conio.h>
#include<stdio.h>
void main()
{
int prime=0,n,i=2;
clrscr();
printf("Enter any number :");
scanf("%d",&n);
while(i<n)
{
  if(n%i==0)
  {
  prime=1;
               break;
  }
  i++;
}
if(prime==0)
printf("prime number");
else
printf("is not a prime number");
getch();
}


No comments:

Post a Comment