Answer to Question #42140 in C++ for felicitas o

Question #42140
Write a C++ program to accept a number. The program should determine if the number
is odd or even
1
Expert's answer
2014-05-07T09:11:43-0400
#include <iostream>
int main() {
int number;
cout << "Please enter the number" << endl;
cin >> number;
if ( number % 2 == 0 ) {
cout << "The number is even" << endl;
} else {
cout << "The number is odd" << endl;
}
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS