Program to check Even or Odd in C++ || Conditional Statement || C++
In this we are going to see how to make a Program in C++ to check whether the number is Even or Odd.

The code given below can be used for TURBO C++ Compiler:-

#include<iostream.h>
#include<conio.h>

void main()
{
        clrscr();
	int a;
	cout<<"Enter you number"<<endl;
	cin>>a;
	if(a%2==0)
	{
		cout<<"The entered number is even number";
	}
	else
	cout<<"The entered number is odd number \n";
	getch();
}
    
    

The code given below can be used for g++/gcc Compiler:-

#include<iostream>
using namespace std;

int main()
{
	int a;
	cout<<"Enter you number"<<endl;
	cin>>a;
	if(a%2==0)
	{
		cout<<"The entered number is even number";
	}
	else
	cout<<"The entered number is odd number \n";
	return 0;
}
    
    

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post