- 1
Write a program to check if the number is even or odd. Take an integer input from the user, if it is even print "even", or "odd"
In c++
4 Respostas
+ 3
Yes, sounds simple.
But where is your code and what is your question?
+ 1
c++ code:
#include <iostream>
using namespace std;
int main()
{
int x;
cout << "Enter an integer: ";
cin >> x;
if (x & 1) // bin &
{
cout << x << " is even.";
}else{
cout << x << " is odd.";
}
return 0;
}
https://code.sololearn.com/cE2wUg7gQUac/?ref=app