Exercises from Chapter 2
Hours in a Year
How you could do it:
How I would do it:
|
puts 24*365 |
puts "(or #{24*366} on occasion)" |
8760 |
(or 8784 on occasion) |
Minutes in a Decade
How you could do it:
How I would do it:
|
puts "#{60*24*(365*10 + 2)} or #{60*24*(365*10 + 3)}" |
Your Age in Seconds
How you could do it:
How I would do it:
puts(Time.new - Time.gm(1976, 8, 3, 13, 31)) |
Our Dear Author’s Age
How you could do it:
puts 1160000000/(60*60*24*365) |
And that’s pretty much how I would do it, too. ☺
..................Content has been hidden....................
You can't read the all page of ebook, please click
here login for view all page.