Monday, 28 March 2016

Write a program to Check Whether Number is Even or Odd using C++ Language.

//Write a program  to Check Whether Number is Even or Odd.

#include <iostream.h>
#include<conio.h>

int main()
{
    clrscr();

    int num;
    cout << "Enter an integer: ";
    cin >> num;
    if ( num%2 == 0)
 {
        cout << num << " is even.";
 }
    else
{
        cout << num << " is odd.";

 
    getch();

    return 0;
}


Output:-

                
 

No comments:

Post a Comment