PROBLEM 77
Medium

Internet Plan Choice

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#77

Given monthly traffic `gb`: choose `S` up to 10 GB, `M` up to 50 GB, otherwise `L`.

EXAMPLE

Example

Input
35
Output
M

LIMITS

Constraints

All numeric input values fit in JavaScript `Number`.
📖
LEARN Theory for this problem
+

### Internet Plan Choice

JavaScript arithmetic works with numeric values stored in variables. A clear solution reads the needed values, computes the formula with `+`, `-`, `*`, `/` or `**`, and prints only the final result.

💡
NEED HELP? Hints
+

['Write the formula using named intermediate values if it contains more than one operation.', 'Build the final state of the data structure first, then convert it to the required output order.']

ANSWER Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let g = Number(input);
if (g <= 10) {
    console.log("S");
} else {
    if (g <= 50) {
        console.log("M");
    } else {
        console.log("L");
    }
}