Write a c++ program to find out the given number is odd or even. This program will print the odd or even number in result. By using this program we can check the number is odd or even using the c++ programming language for beginners.

#include <iostream> using namespace std; int main() { int n; cout << "Enter the number"; cin >> n; if ( n % 2 == 0) cout << n << " is even"; else cout << n << " is odd"; return 0; }

Output:

Enter the number

45

45 is odd

## What is odd number in c++

Odd numbers are integers that, when divided by two, always leave a residue. These are integers of the type n = 2k + 1, where k is a positive integer. -5, -3, -1, 1, 3, 5, 7, and so on are examples of odd numbers.

## What is even number in c++

a whole number that may be split into two equal whole numbers by two. Even numbers are zero, two, four, six, and eight.

## How to implement if else statement in c++ programming

The conditional statements in C++ are as follows: If a particular condition is true, use if to specify a block of code to be run. If the same condition is false, use otherwise to define a block of code to run. If the initial condition is false, use else if to provide a new condition to test.

## What is % or modulo operator in c++

The modulus operator (‘ percent ‘) is a built-in technique in the C and C++ languages that computes the remaining after completing integer division. You may also use the modulus operator to determine if an integer is odd or even. You can do so by asking for the remains of a number after it has been divided by two.