Program to check whether number is even or odd

#include "iostream"
using namespace std;
void main() {
int number;
cout << "Enter an integer: ";
cin >> number;
if ( number % 2 == 0)
cout << number << " is even.";
else
cout << number << " is odd.";

}
Output
Enter an integer: 24
24 is even.

Post a Comment

0 Comments