13 lines
283 B
Text
13 lines
283 B
Text
/* Form the n-th Fibonacci number, n > 1. 12 March 2022 */
|
|
Fib: procedure (n) returns (fixed binary (31));
|
|
declare (i, n, f1, f2, f3) fixed binary (31);
|
|
|
|
f1 = 0; f2 = 1;
|
|
do i = 1 to n-2;
|
|
f3 = f1 + f2;
|
|
f1 = f2;
|
|
f2 = f3;
|
|
end;
|
|
return (f3);
|
|
|
|
end Fib;
|