Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exercise 3 Write a C++ program that prompts the user for an integer. The program

ID: 3820776 • Letter: E

Question

Exercise 3

Write a C++ program that prompts the user for an integer. The program reads the integer and displays "even number" if the number is even or "odd number" if the number is odd. Write a C++ program that prompts the user for a temperature value. The program should print "cool" when the temperature is greater than 40 and less than or equal to 60, should print "warn when the temperature is greater than 60 and less than or equal to 85 and should print "don't go outsider for all other temperature values.

Explanation / Answer

#include <iostream>

using namespace std;

int main()
{
cout << "Enter an integer: ";
int n;
cin >> n;
if (n % 2 == 0)
{
cout << "even number" << endl;
}
else
{
cout << "odd number" << endl;
}

return 0;
}