005-005-010
Temperature Alert System
Easy
Problem Description
In this problem, you will create a program that reads a temperature value, uses the ternary operator to determine whether it is 30 degrees or above, and displays the result to standard output.
Input Format
One line contains the temperature (integer).
Output Format
Output the result judged using the ternary operator.
- Temperature 30 or above: "Hot"
- Temperature below 30: "OK"
Constraints
- -50 ≤ temperature ≤ 50
Key Points
- Ternary operator syntax:
condition ? value_if_true : value_if_false - Can describe the same behavior as if-else in one line
- Convenient when assigning values to variables
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