Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Write a C Program to check whether the given number is prime or not : GTU Nov-Dec 2010

#include
#include
void main()
{
 int number,stop=0,i;

 clrscr();
 printf("\n Enter Number : ");
 scanf("%d",&number);
 for(i=2;i {
  if( (number%i) == 0)
  {
   stop = 1;
   break;
  }
 }
 if(stop == 1 || number == 0 || number == 1)
  printf("\nNumber is not prime.");
 else
  printf("\nNumber is prime.");
 getch();
}


This post first appeared on Ask For Program, please read the originial post: here

Share the post

Write a C Program to check whether the given number is prime or not : GTU Nov-Dec 2010

×

Subscribe to Ask For Program

Get updates delivered right to your inbox!

Thank you for your subscription

×