C++ Program To Check Number Is Even Or Odd Using If/Else Statements

#include <iostream>
using namespace std;
int main() {
    int x;
    cout << "Enter an integer number to check ::\n";
    cin >> x;
    if (x % 2 == 0) {
        cout << "The input number is even.\n";
    } else {
        cout << "The input number is odd.\n";
    }
    return 0;
}

OUTPUT:

Enter an integer number to check ::
7
The input number is odd.

Sharing Is Caring

Leave a Comment