C++ Online Compiler
Example: C++ Program to Check Whether Number is Even or Odd using Function
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ Program to Check Whether Number is Even or Odd using Function #include <bits/stdc++.h> using namespace std; // This function will check the number type void CheckNumber(int x) { if (x % 2 == 0) { cout << "The input number is even.\n"; } else { cout << "The input number is odd.\n"; } } // It's the driver function int main() { int x; cout << "Enter an integer number to check ::\n"; cin >> x; CheckNumber(x); return 0; }
21
Output
Clear
ADVERTISEMENTS