C++ program 

Check Whether Number is Even or Odd using if else:

Programming in c++:

C++ code that asks a user to enter any integer value and display either Entered value as an Even no. or an Odd no:


c++ code:

C++ program  Check Whether Number is Even or Odd using if else


Source code:

#include <iostream>//  iostream provides basic
// input and output services for C++ programs
using namespace std;

int main()
// Th execution of program start with the main function
{
    int n;

    cout << "Enter an integer: "; // cout is used to display
    // the same statement in the output.
    cin >> n;// Cin used to enter a value by the user.

    if ( n % 2 == 0)/*The if/else statement executes a 
    block of code if a specified condition is true.
    If the condition is false,
 another block of code can be executed.*/
        cout << n << " is even.";
    else
        cout << n << " is odd.";

    return 0;
}