PROBLEM 23
Easy

Difference of Numbers

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#23

Given `a` and `b`, print `a - b`.

EXAMPLE

Example

Input
10 3
Output
7

LIMITS

Constraints

The input sequence contains at most 100000 elements; numeric values fit in JavaScript `Number`.
📖
LEARN Theory for this problem
+

### Difference of Numbers

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 input = fs.readFileSync(0, 'utf8').trimEnd();
let [a, b] = input.trim().split(/\s+/).filter(Boolean).map(Number);
let result = (a - b);
console.log(result);