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
Expert's answer
#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 first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal