Program in C to find that number is prime or not (7,11,13,17,19 etc.)

Write a program in C to find that number is prime or not (7,11,13,17,19 etc.)

#include <stdio.h>
#include <conio.h>

void main ()
{
          int no,i=2;
          clrscr ();
          printf ("Enter Number: ");
          scanf ("%d",&no);
          while (i<=no)
          {
                   if (no%i==0)
                             break;
                   i++;
          }
          if (i==no)
                   printf ("Number is Prime");
          else
                   printf ("Number is not Prime");
          getch ();
}


Post a Comment