C++ Program to Check Even or Odd Number
Here you get a C++ program to check even or odd number. In this program first we will get a number as input, divide the number by 2 (if reminder is zero, number is even, else Number is odd“), print result.
Example of C++ Program to Check Even or Odd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> using namespace std; int main() { int num; cout << "Enter a number : "; cin >> num; if ( num % 2 == 0) cout << num << " is even number."; else cout << num << " is odd number."; return 0; } |
Output
Check out our other C++ programming Examples