rubyx/test/runners/fibo_while.rb

14 lines
152 B
Ruby
Raw Normal View History

2014-05-10 18:02:51 +02:00
def fibonaccit(n)
a = 0
b = 1
while( n > 1 ) do
2014-05-10 18:02:51 +02:00
tmp = a
a = b
b = tmp + b
putstring(b)
2014-05-10 18:02:51 +02:00
n = n - 1
end
end
fibonaccit( 10 )