Q:

Write a JavaScript program to convert a given number to hours and minutes

0

Write a JavaScript program to convert a given number to hours and minutes.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function time_convert(num)
 { 
  var hours = Math.floor(num / 60);  
  var minutes = num % 60;
  return hours + ":" + minutes;         
}

console.log(time_convert(71));
console.log(time_convert(450));
console.log(time_convert(1441));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now