Question: Write a for loop that asks the user to input n temperature values using a for loop, for each temperature, the program displays a message

Write a for loop that asks the user to input n temperature values using a for loop, for each temperature, the program displays a message based on the following rules.

if the temperature is less than or equal to 32, display "It is freezing."

if the temperature is between 33 and 50 (both inclusive), display "It is cool."

if the temperature is between 51 and 75 (both inclusive), display "It is warm."

otherwise, display "It is hot."

n is the first user input. Sample runs Input 1:

3 76 31 45 

Output 1:

It is hot. It is freezing. It is cool. 

Input 2:

6 32 45 51 25 100 75 

Output 2:

It is freezing. It is cool. It is warm. It is freezing. It is hot. It is warm.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!