All pastes #899177 Raw Edit

Something

public text v1 · immutable
·published 2008-02-10 23:08 UTC
rendered paste body
puts "Enter a maximum value:"
max = gets.chomp.to_f

count = 1
number = 0
while number < max
  count++
  number = 2 ** count
end

number /= 2
count--

puts "2^" + count.to_s + " = " + number.to_s + " is the highest power of 2 less than " + max.to_s