I'm trying to figure out a way to create a program that has a user input a positive integer, and output a statement to the user that if the the number entered is 1 - "Number must be 2 or larger...Please enter another Positive Integer", 2 - "Number is an EVEN number", but I'm getting stuck on how to let the user know that the number entered is an ODD integer.....I just don't know how to tell the computer to compute whether or not it's odd....any ideas!?!
This is what I have so far:
#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
int posnum;
int oddint;
int i;
while (true)
{
cout << "Please Enter a Positive Integer: ";
cin >> posnum;
cout << endl;
if (posnum == 1)
cout << "Number must be 2 or larger...Please enter another Positive Integer\n";
else if (posnum == 2)
cout << "Number is an EVEN number\n";
}
cout << endl;
}