Posts Tagged Fibonacci

A Fibonacci generator in Ruby

 

“I never new Ruby can make me!” – Fibonacci

Generates 10 Fibonacci numbers


f1 =-1; f2 = 1; f3= 0; 10.times{ f3=f1+f2; f1=f2; f2=f3; puts f3}

Advertisements

, ,

Leave a comment