Add Seven
Programming Basics · JavaScript
TASK
Problem
Given an integer `n`, print `n + 7`.
EXAMPLE
Example
12
19
LIMITS
Constraints
All numeric input values fit in JavaScript `Number`.
LEARN
Theory for this problem
+
### Add Seven
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.', 'Order the checks so a more specific case is not swallowed by a broader condition.']
ANSWER
Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let n = Number(input);
let result = (n + 7);
console.log(result);