Question: Write a C + + program that checks whether an integer is a positive / negative / zero number, and whether it is an odd

Write a C++ program that checks whether an integer is a positive/negative/zero number, and whether it is an odd/even number.
(Hint: For odd/even numbers, use the modulus operator (%) and check the integer is divisible by 2.)
You will use this program:
#include
using namespace std;
int main(){
int input;
cout << "Enter an integer: ";
cin >> input;
// if-else statement
......
return 0;
}
Sample Output: Red colored texts are user inputs. Other texts are the output of the program.
Enter an integer: -22
-22 is Negative and Even

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!