Infolinks - Earn Easy Money

Saturday, April 4, 2015

C++ Program to find the given number is Even or Odd using Switch

#include <iostream>
using namespace std;
int main ( )
{
int num;
cout <<" Enter a number ";
cin >> num;

 switch ( num % 2 )
 {
   case 0 :
    cout <<" The number is even ";
    break ;
   case 1 :
 cout <<" The number is odd ";
break ;
 }
  return 0 ;
}

No comments:

Post a Comment

Must drop your comments about post.