This one is stumping me because of all the variables needed. Only thing

taught before this challenge was basic branches and loops. This is what

I have so far.

puts ‘Leap Year Calculator’

puts ’ ’

puts ‘Enter the starting year.’

starting_year = gets.chomp

puts ‘Enter the ending year.’

ending_year = gets.chomp

while true

if starting_year % 400 ||starting_year % 4

leap_year = starting_year

elsif starting_year % 100

leap_year = starting_year + 4

else

# need something to check until it reaches / by 4 or 400, adding one

each time maybe.

end

while leap_year.to_i < ending_year.to_i

puts leap_year

leap_year = leap_year.to_i + 4

end

break

end

Works okay if I put a leap year, or one dividable by 100. But I’m not

sure how to do this when I enter a number not dividable by 100, 4, or

400 (Where I have the comment is where I think the code needs to go.)

Also what I’m using is all the book has gone over so far so please,

nothing not using what I’m using. Thanks in advance.