Created
January 11, 2017 11:46
-
-
Save wethu/5050e5aa2192635f95f037906fe2a7eb to your computer and use it in GitHub Desktop.
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
#!/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