Skip to content

Solución Reto #31 (programación de líneas de Ruby) #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/ruby

def is_leap_year (year)
return year%4 == 0 && year%100 !=0 || year%400 == 0
end

def print_next_leap_years (amount, year)
$printed = 0
while $printed < amount do
year += 1
if is_leap_year(year)
$printed += 1
puts year
end
end
end

print_next_leap_years(30, 1999)