Question #258109

Create a program will ask the user to enter an integer number and a string if the integers number is oddprint the string words that the user enter and if the integers number is even print the even numbers with the string words this is an even number.

Expert's answer

#include <iostream>

using namespace std;

int main()
{
  int var;
  string s;
   
  std::cout << "enter integer number\n";

  std::cin >> var;
   
  std::cout << "enter string\n";

  std::cin >> s;
   
  if (var % 2)
    std::cout << s << "\n";
  else
    std::cout << var << " - this number is even";
    ;

}
LATEST TUTORIALS
APPROVED BY CLIENTS