+ 1

who can write a c++ program that reads an integer and determines and prints whether it is odd or even.

13th Jan 2017, 1:52 PM
Abdulla Muhamad
Abdulla Muhamad - avatar
3 Respostas
+ 7
#include <iostream> using namespace std; int main() { unsigned x; cin>>x; if(x%2==0) cout<<"Even"; else cout<<"Odd"; return 0; }
13th Jan 2017, 4:40 PM
Filip
Filip - avatar
+ 3
int a, int b; cin >> a; b = a%2; if (b==0){ cout << "EVEN"; } else { cout << "ODD"; }
13th Jan 2017, 2:13 PM
Jason Hoffman
Jason Hoffman - avatar
0
Receive a number and determine whether it is odd or even
16th Mar 2024, 4:28 PM
Elias Gemechu
Elias Gemechu - avatar