Write a C++ Program to Find whether given Number is Odd or Even.
Solution:
/* C++ Program to Find whether given Number is Odd or Even */
#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter any positive number :: ";
cin>>a;
if(a%2==0)
{
cout<<"
The Entered Number [ "<<a<<" ] is EVEN Number.
";
}
else
{
cout<<"
The Entered Number [ "<<a<<" ] is ODD Number.
";
}
return 0;
}
Output:
/* C++ Program to Find whether given Number is Odd or Even */
Enter any positive number :: 1327
The Entered Number [ 1327 ] is ODD Number.
Process returned 0
| Is This Answer Correct ? | 0 Yes | 0 No |
How to invoke a C function using a C++ program?
Explain encapsulation in C++.
Write a program that ask for user input from 5 to 9 then calculate the average
In C++ what do you mean by Inheritance?
What do you know about Volatile keyword in C++? Explain with an example code.
In C++ what is a vtable and how does it work?
Write a C++ Program to Check Whether a character is Vowel or Consonant.
What is conversion constructor in C++
Write a program to generate the Fibonocci Series in C++.
What is the purpose of a constructor? Destructor?
In C++ what is the meaning of data hiding?
Define type casting in C++.