CPP PROGRAM TO CHECK NUMBER IS EVEN OR ODD

In this program, you will learn about how to check the number is even or odd in the cpp programming language.

For understanding ,you must learn following topics

output method

input method

if else


Code:

#include <iostream>

using namespace std;


int main()

{

int var;

cout<<" enter any number to check even or odd "<<endl;

cin>>var;


if(var%2==0)

{

cout<<" It is even number "<<var;


}

else

{


cout<<" it is odd number "<<var;

}

    return 0;

}

Output:

 enter any number to check even or odd

5

 it is odd number 5

Comments

Popular posts from this blog

Diferrence between flutter and react native

Flutter Widgets

Flutter layout