Skip to content

Instantly share code, notes, and snippets.

@wethu
Created January 11, 2017 11:46
Show Gist options
  • Save wethu/5050e5aa2192635f95f037906fe2a7eb to your computer and use it in GitHub Desktop.
Save wethu/5050e5aa2192635f95f037906fe2a7eb to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -w
require "date"
puts "Enter Start Year:"
start_year = gets.to_i
puts "Enter End Year:"
end_year = gets.to_i
puts "These are the leap years:"
(Date.new(start_year)..Date.new(end_year)).select(&:leap?).uniq(&:year).map(&:year).each(&method(:puts))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment