Write a C++ Program For Check Whether Number is Even or Odd

Ram Pothuraju
nclude <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;
}


Output

Enter an integer: 23
23 is odd.

Post a Comment

0Comments

Post a Comment (0)