Friday, October 28, 2016

C++ basic program

Any integer is input by the user. Write a program to find out whether it is an odd number or even number. 

 int main()
{
      int a;
      cout<<"Enter any number : ";
      cin>>a;
 
      if(a%2==0)
            cout<<"The number is even";
      else
            cout<<"The number is odd";
      
      getch();
      return 0;

}

No comments:

Post a Comment