Question #42140

Write a C++ program to accept a number. The program should determine if the number
is odd or even

Expert's answer

#include <iostream>int main() {    int number;    cout << "Please enter the number" << endl;    cin >> number;    if ( number % 2 == 0 ) {        cout << "The number is even" << endl;    } else  {        cout << "The number is odd" << endl;    }    return 0;}
LATEST TUTORIALS
APPROVED BY CLIENTS