EasyConditionsNot started

Cold-room alert

A food store classifies a cold-room reading. Print COLD below 2 degrees, OK from 2 through 5 degrees inclusive, and WARM above 5 degrees.

Input

One line: a decimal temperature.

Output

One line: COLD, OK or WARM.

Example 1

Input

4.5

Output

OK

4.5 lies inside the inclusive safe range.

Constraints

  • -50 <= temperature <= 100

Hints

Hint 1 of 3

Test the lower boundary first.

Hint 2 of 3

Reaching the second branch already means the value is at least 2.

Hint 3 of 3

Use <= 5 so the upper boundary stays safe.

Solution

Show a reference solution and explanation
 JavaScript · reference solution
const temperature = Number(readline());
if (temperature < 2) {
  console.log('COLD');
} else if (temperature <= 5) {
  console.log('OK');
} else {
  console.log('WARM');
}

Why it works

The ordered branches partition all possible readings without gaps. Testing the thresholds directly also makes the inclusive and exclusive boundaries visible to the reader.

Lesson for this exercise: Conditions in JavaScript: if, else if, else and switch

Your program
const temperature = Number(readline());
// print the correct classification

Tests: 4 cases including the examples. Passing every test marks the exercise solved in this browser.

How this page was checked. Every program on it was run with Node.js 22 at build time; runs in your browser in an isolated Web Worker by the publishing checks, and the output shown is what it printed. The Run buttons execute the same code on your device; nothing you type is sent anywhere.