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 |
Write a C++ Program to Find whether given Number is Odd or Even.
Discuss the role of C++ shorthands.
What is the difference between malloc, calloc and realloc?
What kind of problems does name mangling cause?
Write a C++ Program to Find Sum and Average of three numbers.
Can we use THIS Pointer in static function – Reason in C++?
Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70
What is placement new?
What is RTTI and why do you need it?
What is a COPY CONSTRUCTOR and when is it called?
C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.
What is static variable and difference between(const char *p,char const *p,const char* const p).