C++ Online Compiler
Example: Write a Program to Check Whether the Given Number is Even or Odd in C++ using If-else
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// Write a Program to Check Whether the Given Number is Even or Odd in C++ using If-else #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; }
7
Output
Clear
ADVERTISEMENTS