/ruby/leap/year.rb

1
2
3
4
5
6
class Year
  def self.leap?(year)
    # Return true if year is leap, false otherwise
    ((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0)
  end
end

Comments


You're not logged in right now. Please login via GitHub to comment