Monday, March 26, 2012

Program to find whether it is prime number or not in C code


/*****************<soeasyprograms.blogspot.in>******************/


/*program to find whether a number is prime or not*/


#include<stdio.h>
#include<conio.h>
void main()
{
   int i,n;
   clrscr();
   printf(" Enter the number ");
   scanf("%d",&n);
   for(i=2;i<n;i++)
   {
      if(n%i==0)
      {
      printf("Number is not prime");
      break;
      }
   }
      if(i==n)
      printf("Number is prime");
      getch();
}


/*****************<soeasyprograms.blogspot.in>******************/

No comments:

Post a Comment