Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/Fibonacci-sequence/Pascal/fibonacci-sequence-3.pas
Normal file
22
Task/Fibonacci-sequence/Pascal/fibonacci-sequence-3.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
function fib(n: integer): integer;
|
||||
var
|
||||
f0, f1, tmpf0, k: integer;
|
||||
begin
|
||||
f1 := n;
|
||||
IF f1 >1 then
|
||||
begin
|
||||
k := f1-1;
|
||||
f0 := 0;
|
||||
f1 := 1;
|
||||
repeat
|
||||
tmpf0 := f0;
|
||||
f0 := f1;
|
||||
f1 := f1+tmpf0;
|
||||
dec(k);
|
||||
until k = 0;
|
||||
end
|
||||
else
|
||||
IF f1 < 0 then
|
||||
f1 := 0;
|
||||
fib := f1;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue