005-002-015
Branching with If-Else Statement
Medium
Problem Description
Branching with If-Else Statement
In this problem, you will create a program that reads a temperature (integer) from standard input and uses if-else if statements to determine and display a temperature sensation string based on the temperature range.
Learning Objective: Understand exclusive conditional branching with if-else and if-else if statements
Overview
The if-else statement executes different code for true and false conditions. The if-else if chain handles multiple exclusive conditions.
Specifications
- Read one integer from standard input and assign it to
temperature - If 35+: "Very Hot", 30+: "Hot", 20+: "Warm", 10+: "Cool", else: "Cold"
- Only one result message should be displayed
Input Format
temperature (integer)
Output Format
Temperature: <temperature>
Feeling: <feeling>
Sample Input/Output
Input:
28
Output:
Temperature: 28
Feeling: Warm
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up