Convert minutes into hours (Ruby)

Task is pretty straightforward take a number of minutes, i.e 109 and return it in the format of 1:49.

# Write a method that will take in a number of minutes, and returns # a string that formats the number into `hours:minutes`.

I will use the Division and the Modulus operators in Ruby, the first one returns a quotient, the later one returns the remainder. I.e.

7 / 3 = 2 #quotient
7 % 3 = 1 #remainder

We define two variables within our method, hours for number of hours and rest for the minutes:

def time_conversion(minutes)
hours = minutes / 60
rest = minutes % 60
puts "#{hours}:#{rest}"
#=> 1:49


One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.