Last active
December 22, 2015 01:49
-
-
Save bricejlin/6399502 to your computer and use it in GitHub Desktop.
ruby learning wk 2 ex 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def leap_year?(year) | |
if year % 100 == 0 | |
year % 400 == 0 ? true : false | |
else | |
year % 4 == 0 ? true : false | |
end | |
end | |
def minutes_in_year(year) | |
if leap_year?(year) | |
puts "In #{year} (a leap year), there were #{365 * 24 * 60} minutes." | |
else | |
puts "In #{year}, there were #{366 * 24 * 60} minutes." | |
end | |
end | |
minutes_in_year(2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment