2013-04-10 22:43:41 -07:00
|
|
|
/* Form the n-th Fibonacci number, n > 1. */
|
2015-02-20 00:35:01 -05:00
|
|
|
get list(n);
|
|
|
|
|
f1 = 0; f2 = 1;
|
|
|
|
|
do i = 2 to n;
|
2013-04-10 22:43:41 -07:00
|
|
|
f3 = f1 + f2;
|
2015-02-20 00:35:01 -05:00
|
|
|
put skip edit('fibo(',i,')=',f3)(a,f(5),a,f(5));
|
2013-04-10 22:43:41 -07:00
|
|
|
f1 = f2;
|
|
|
|
|
f2 = f3;
|
|
|
|
|
end;
|