Skip to content

Instantly share code, notes, and snippets.

@MtnBiker

MtnBiker/gist:9063879

Last active Aug 29, 2015
Embed
What would you like to do?
Leap year w2e3 Ruby Course.
def not_leap_year(year)
puts "#{year} is not a leap year"
end
def leap_year(year)
if (year % 4) == 0
if year % 100 == 0
if year % 400 == 0
puts "There are #{year*366*24*3600} seconds in the leap year #{year}"
else
not_leap_year(year)
end
else
not_leap_year(year)
end
else
not_leap_year(year)
end
end # leap_year
leap_year(2000)
leap_year(1900)
leap_year(25)
leap_year(1645)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.