PROBLEM 6
Easy

Minutes to Hours and Minutes

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#6

Given non-negative minutes `m`, print full hours and remaining minutes separated by a space.

EXAMPLE

Example

Input
135
Output
2 15

LIMITS

Constraints

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

### Minutes to Hours and Minutes

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.', 'Verify the accumulator initial value and both loop boundaries; this is where off-by-one errors most often appear.']

ANSWER Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let m = Number(input);
console.log(Math.floor((m) / (60)), (((m) % (60)) + (60)) % (60));