Coderbyte Time Convert (Easy)

Challenge
Using the JavaScript language, have the function TimeConvert (num) take the num parameter being passed and return the number of hours and minutes the parameter converts to (ie. if num = 63 then the output should be 1:3). Separate the number of hours and minutes with a colon.
Hint
Dividing the number by 60 will give you the number of hours, and then to get the minutes the modulo operation will be useful.
Sample Test Cases

Input: 126
Output: “2:6”
Input: 45
Output: “0:45”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s