C++ Programming

Even Odd

C plus plus example for even odd number calculation

10/28/2019
0 views
even-odd.cppCPP
#include<iostream>
using namespace std;

int main() {
	int no;
	cout << "Enter a number:\n";
	cin >> no;

	/* Check the modulus of 'no' is zero or not */
	if(no%2 != 0)
		cout << "The given no is ODD!\n";
	else
		cout << "The given no is EVEN!\n";
	return 0;
}


/* Output */
/* Enter a number:
4

The given no is EVEN! */


/* -------------------------------- */

/* Enter a number:
9

The given no is ODD! */
cppc plus pluseven odd number

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com