Wednesday, 7 November 2012

Even And Odd Number.

#include <iostream>
using namespace std;
int main ()
{

   int no;
   cout << "Give me any number: ";
   cin >> no;

   if (no % 2 == 0) {
       cout << no <<" is even." << endl;
   }
   else
   {
       cout << no <<" is odd." << endl;
   }

   return 0;
}

No comments:

Post a Comment