001-004-012

Decrement and Conditional Output

Medium

Problem Description

Decrement and Conditional Output

Learning Objective: Update a variable by subtraction and output based on conditions

Overview

Declare an integer variable temperature, initialize it with 25, subtract 8, and output the result along with whether it's cold or warm.

Specifications

  • Initialize variable temperature with 25
  • Subtract 8 from temperature
  • Output the updated temperature
  • Output "Cold" if temperature is below 20, otherwise "Warm"

Output Format

Temperature: 17
Cold

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?