Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Check number is Even or Odd

 C++ Program to check the number is Even or Odd:Numbers perfectly divisible by 2 are known even numbers and numbers which are not divisible by 2 are called odd numbers.This program takes an integer from user and checks whether that number is even or odd and displays the result.In this program, user is asked to enter an integer which is stored in variable a. Then, the remainder is found when that number is divided by 2 and checked whether remainder is 0 or not.
If remainder is 0 then, that number is even otherwise that number is odd. This task is performed using if...else statement in C programming and the result is displayed accordingly.


Source Code:-

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

void main()
{clrscr();
 int a;
 cout<<"Check Number is Even or Odd by-Tarun Rawar\n";
 cout<<"\nEnter number to  check : ";
 cin>>a;
 if(a%2==0)
  cout<<"\n"<<a<<" is a Even number ";
 else cout<<"\n"<<a<<" is a Odd number ";
getch();
}















No comments:

Post a Comment

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)