PROGRAM ON FINDING ODD EVEN NUMBER AND WHEATHER THE NUMBER IS PRIME OR NOT

#include<iostream.h>
#include<conio.h>
void main()
{ int num,i,flag=0,n;
  clrscr();
  cout<<"Enter the no.:";
  cin>>num;
  if(num%2==0)
      cout<<"Even\n";
  else
      cout<<"Odd\n";
  for(i=2;i<n/2;i++)
  {
    if(num%i==0)
    {
       cout<<"No. is not prime";
       flag=1;
       break;
    }
  }
  if(flag==0)
  cout<<"No. is prime";
  getch();

}

Comments

Popular Posts