c 2b 2b check if odd or even

Solutions on MaxInterview for c 2b 2b check if odd or even by the best coders in the world

showing results for - "c 2b 2b check if odd or even"
Océane
23 Feb 2020
1#include <iostream>
2using namespace std;
3
4int main() {
5  int n;
6
7  cout << "Enter an integer: ";
8  cin >> n;
9    
10  (n % 2 == 0) ? cout << n << " is even." :  cout << n << " is odd.";
11    
12  return 0;
13}