C++

C++ Program to Check Whether 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;
}

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Close
Close

Adblock Detected

Please consider supporting us by disabling your ad blocker