+ 1
who can write a c++ program that reads an integer and determines and prints whether it is odd or even.
3 Answers
+ 7
#include <iostream>
using namespace std;
int main() {
unsigned x;
cin>>x;
if(x%2==0)
cout<<"Even";
else
cout<<"Odd";
return 0;
}
+ 3
int a, int b;
cin >> a;
b = a%2;
if (b==0){
cout << "EVEN";
}
else {
cout << "ODD";
}
0
Receive a number and determine whether it is odd or even