댓글 검색 목록

[javascript] 주어진 숫자를 시와 분으로 변환하는 자바 스크립트 프로그램을 작성하십시오.

페이지 정보

작성자 운영자 작성일 17-12-30 14:56 조회 1,341 댓글 0

코드 : 

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));



결과 :

1:11

7:30

24:1



댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.