programming-examples/c++/Others/Add an else part to the if statement.cpp
2019-11-15 12:59:38 +01:00

15 lines
306 B
C++

Add an else part to the if statement
#include <iostream>
using namespace std;
int main(void)
{
int num;
cout << "Enter a whole number: ";
cin >> num;
if ( num % 2 == 0 )
cout << "The number is even" << endl;
else
cout << "The number is odd" << endl;
return 0;
}