rubyx/test/runners/fibo_while.rb
2014-05-12 21:36:38 +03:00

14 lines
147 B
Ruby

def fibonaccit(n)
a = 0
b = 1
while( n > 1 ) do
tmp = a
a = b
b = tmp + b
puts(b)
n = n - 1
end
end
fibonaccit( 10 )