Skip to content

Instantly share code, notes, and snippets.

@rapsad
Created November 24, 2013 22:34
Show Gist options
  • Save rapsad/7633354 to your computer and use it in GitHub Desktop.
Save rapsad/7633354 to your computer and use it in GitHub Desktop.
require 'date'
public
print "Enter a year: "
arr = [2000, 2004, 1900, 2005]
minutes_leap_year = 366*24*60
minutes_nleap_year = 365*24*60
puts "\n"
arr.each do |year|
current_date = DateTime.new(year.to_i, 1, 1)
if Date.leap?( current_date.year )
puts "The year #{year} has #{minutes_leap_year} minutes"
else
puts "The year #{year} has #{minutes_nleap_year} minutes"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment