Rectangle Area
Programming Basics · JavaScript
TASK
Problem
Given rectangle sides `a` and `b`, print the area.
EXAMPLE
Example
6 8
48
LIMITS
Constraints
a > 0; b > 0
LEARN
Theory for this problem
+
### Rectangle Area
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.', 'Before printing, output only the computed result and do not add explanatory text that is absent from the required format.']
ANSWER
Solution
+
const fs = require('fs');
const [width, height] = fs
.readFileSync(0, 'utf8')
.trim()
.split(/\s+/)
.map(Number);
const area = width * height;
console.log(area);