mirror of
https://github.com/heqin-zhu/algorithm.git
synced 2024-03-22 13:30:46 +08:00
17 lines
205 B
Plaintext
17 lines
205 B
Plaintext
|
func fib(n)
|
||
|
begin
|
||
|
if n=1 || n=2 then return 1;
|
||
|
return fib(n-1)+fib(n-2);
|
||
|
end ;
|
||
|
|
||
|
var n=1;
|
||
|
begin
|
||
|
while n<15 do
|
||
|
begin
|
||
|
print('fib[%d]=%d',n,fib(n));
|
||
|
n :=n+1;
|
||
|
end;
|
||
|
|
||
|
end
|
||
|
.
|