hello I am new here and new to ruby (no programming experience but
willing to learn)

I am following "Daniel Carrera" tutorial I am already at while loops and
fairly I understand of it but the one thats bugging me is the exercise
of the power of 2.

heres the exercise:

Rewrite this last program so that the computer asks for the maximum
number and the program computes the corresponding power of two.

Enter maximum value:
124123
2^17 =131072 is the highest power of 2 less than 124123


heres my code;

puts "Enter a maximum value: "
number =gets.chomp.to_i
high =number
while number < 10_000
    number *= 2
end
 puts high.to_s + " is the highest " + \
      "power of 2 less than " + number.to_s


this is the site:
http://localdoc.scusa.lsu.edu/ruby/Tutorial/part_02/while.html

thanks for anyone answering

-- 
Posted via http://www.ruby-forum.com/.