C++ Program to Check if Given Number is Odd or Even

Write C++ Program to Check if Given Number is Odd or Even

#include <iostream>

using namespace std;

int main()
{
	int n;

	cout << "Enter the number :--> ";
	cin >> n;

	if(n % 2 == 0)
	{
		cout << "The given number is EVEN";
	}
	else
	{
		cout << "The given number is ODD";
	}

	return 0;
}

Output:

Run 1:
Enter the number :--> 0
The given number is EVEN

Run 2:
Enter the number :--> 5
The given number is ODD

Run 3:
Enter the number :--> 3
The given number is ODD

≪ Previous | Next ≫