Q:

Find even and odd numbers using c++

0

Write a program to find even and odd numbers.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
#include <string>
using namespace std;
int main(){
 int number;
 cout << "Enter the number : ";
cin >> number;
    if (number%2== 0) 
        cout << number << " is an (even) integer " << endl;
    else
        cout << number << " is an (odd) integer " << endl; 
}

 

Output:

Enter the number : 35
35 is an (odd) integer

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a program to enter a number between 1 to 100... >>
<< Entering an array and printing its inverse using c...