> Look at this: > > while year_one.to_i < year_two.to_i > if false > if year_one%100 != 0 || year_one%400 == 0 > total = total + 1 > year_one = year_one+ 1 > else > year_one = year_one+ 1 > end > > Also, what value is stored in the variable year_one right before the > while loop starts? I think I've determined my problem; it relates to the variable 'year_one.' year_one is supposed to be the first year entered when the program starts. Check out my revision, which appears to work: puts 'Use this calculator to determine the leap years in a specific period.' puts 'Enter the starting point below:' start = gets.chomp.to_i puts 'Enter the ending point below:' ending = gets.chomp.to_i year = start total = 0 while year <= ending if year%4 == 0 if year%100 != 0 || year%400 == 0 puts year total = total + 1 end end year = year + 1 end if total == 1 puts 'There is 1 leap year between ' puts start.to_s + ' and ' + ending.to_s + '.' else puts 'There are ' + total.to_s + ' leap years between ' puts start.to_s + ' and ' + ending.to_s + '.' end -- Posted via http://www.ruby-forum.com/.