C++ Program to Check the Number is Even or Odd
This C+ +Program checks if a given integer is odd or even. Here if a given number is divisible by 2 with the remainder 0 then the number is even number. If the number is not divisible by 2 then that number will be odd number.
Here is source code of the C++ program which checks a given integer is odd or even. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
Practice Question :
1.Wap to check the number is prime or not
2.Wap to check the character is vowel, consonants or special character.
3.Wap to find the sum of n natural numbers.
4.Wap to print all prime number in given range taking range from users.
5.Wap to print the multiplicaton table .
source code :
//even or odd
#include<iostream>
using namespace std;
int main(){
int number;
cout<<"Enter the number : "<<endl;
cin>>number;
if(number%2==0)
cout<<"The number you entered is even"<<endl;
else
cout<<"The number you entered is odd"<<endl;
return 0;
}
ConversionConversion EmoticonEmoticon