minutes to hours

Solutions on MaxInterview for minutes to hours by the best coders in the world

showing results for - "minutes to hours"
Harmony
11 Jul 2016
1function timeConvert(n) {
2var num = n;
3var hours = (num / 60);
4var rhours = Math.floor(hours);
5var minutes = (hours - rhours) * 60;
6var rminutes = Math.round(minutes);
7return num + " minutes = " + rhours + " hour(s) and " + rminutes + " minute(s).";
8}
9
10console.log(timeConvert(200));
11
12