WAP To Print Whether A Prime No. Or Not.

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
Void main()
{   clrscr();
     int i,n,flag=0;
     cout<<”Enter the no.”;
     cin>>n;
     for(i=2;i<=n/2;i++)
     {    
            if(n%i=0)
            {     
                   cout<<”No. is not prime”;
                    flag=1;
                     break;
             }
      }
              if(flag=0)
              cout<<”No. is prime”;
              getch();

  }   

Comments

Popular Posts