# Answer to Question #60487 in C++ for shruti

Question #60487

write a C++ program to accept a four digit number and print whether it is odd or even number. Write a program to print the digits of the number in reverse order. (e.g 1234 is an even number. The reverse of the numbers 4321).

Expert's answer

#include <iostream>

using namespace std;

int main()

{

int n = 0;

//Obtaining the number n

cout << "Enter an integer number:";

cin >> n;

//if the remainder of the division by 2 is 1, then the number is even, else - odd

if (n % 2)

cout << "The number is odd.";

else

cout << "The number is even.";

return 0;

}

using namespace std;

int main()

{

int n = 0;

//Obtaining the number n

cout << "Enter an integer number:";

cin >> n;

//if the remainder of the division by 2 is 1, then the number is even, else - odd

if (n % 2)

cout << "The number is odd.";

else

cout << "The number is even.";

return 0;

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment