Answer to Question #270372 in C++ for Shaminie

Question #270372

Create a program that will ask the user to input an integer and intify the integer is an odd or even.

1
Expert's answer
2021-11-23T09:03:59-0500
#include <iostream>
using namespace std;


int main() {
  int n;


  cout << "Enter an integer: ";
  cin >> n;


  if ( n % 2 == 0)
    cout << n << " is even.";
  else
    cout << n << " is odd.";

  cin >> n;
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS