-
-
Save mazeltov7/5675961 to your computer and use it in GitHub Desktop.
閏年(ruby)
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
puts '先頭の年' | |
start = gets.chomp.to_i | |
puts '末尾の年' | |
stop = gets.chomp.to_i | |
puts 'うるう年一覧' | |
year = start | |
while year <= stop | |
if (year % 400 == 0) || | |
(year % 100 != 0 && year % 4 == 0) | |
puts year | |
end | |
year +=1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment