Instructions:
Input one integer.
Print out the integer in one line.
Check whether the integer is odd or not. If it is odd, print "Odd".
Input
A line containing an integer
5
Output
The first line contains the inputted integer.
The second line contains a string which is the result.
5
Odd
#include <iostream>
int main()
{
int num1;
std::cin>>num1;
std::cout<<num1<<std::endl;
if(num1 % 2 == 0)
{
std::cout<<"Even"<<std::endl;
}
else
{
std::cout<<"Odd"<<std::endl;
}
return 0;
}
Comments
Leave a comment