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 |
Explain the difference between C and C++.
Write a C++ Program to Find Sum and Average of three numbers.
How can a C function be called in a C++ program?
Write a C++ Program to Find whether given Number is Odd or Even.
Explain about Searching and sorting algorithms with complexities
To solve the 8 Queens problem, which algorithm is used?
How to delete array of objects in C++? Proof by C++ code for proper deletion
Write a program to generate the Fibonocci Series in C++.
Identify the error in the following program. include<iostream> using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }
When would you use a pointer? A reference?
What is function overloading and operator overloading in C++?
How do you write a function that can reverse a linked-list in C++?