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;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.