Number of Tens
Programming Basics · JavaScript
TASK
Problem
Given non-negative integer `n`, print the number of complete tens.
EXAMPLE
Example
347
34
LIMITS
Constraints
All numeric input values fit in JavaScript `Number`.
LEARN
Theory for this problem
+
### Number of Tens
Integer division separates higher decimal/time units, while `%` returns the remainder. These two operations let a program isolate digits or split a total number of seconds/minutes into components.
NEED HELP?
Hints
+
['Decide which part comes from division and which part comes from the remainder.', 'After each iteration, it should be clear what has already been accumulated and what remains to be processed.']
ANSWER
Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let n = Number(input);
let result = Math.floor((n) / (10));
console.log(result);