PROBLEM 41
Medium

Age Check

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#41

Given `age`, print `CHILD` if it is below 14, otherwise `TEEN_OR_ADULT`.

EXAMPLE

Example

Input
12
Output
CHILD

LIMITS

Constraints

0 ≤ age ≤ 120
📖
LEARN Theory for this problem
+

### Age Check

`if / else if / else` chooses a branch from boolean conditions. Comparisons such as `<`, `>=`, `===` and logical operators `&&`, `||`, `!` combine the exact rules that decide which output is valid.

💡
NEED HELP? Hints
+

['Translate every case from the statement into a boolean condition before writing branches.', 'Mentally substitute at least one value for each branch and verify that exactly the intended branch runs.']

ANSWER Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let age = Number(input);
if (age < 14) {
    console.log("CHILD");
} else {
    console.log("TEEN_OR_ADULT");
}