Wednesday 4 February 2015

C++ Program to Check the Number is Even or Odd

C++ Program to Check the Number is Even or Odd

#include <iostream>
using namespace std;

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

    }
    return 0;
}

No comments:

Post a Comment