// pgm8 -- if statement // compound stmt with {} // logical operators // 9/14/16 #include #include using namespace std; int main() { int x; cout << "Enter an integer greater than zero and we will tell you whether " << "it is odd or even, and if it is even, divide by 2. "; cin >> x; if (x==0) { cout << "You entered zero!" << endl; exit(5); // stops running the program } if (! (x % 2 == 1)) { cout << x << " is even." << endl; x/=2; cout << "Now half of x is: " << x << endl; } else cout << x << " is odd." << endl; return 0; }