Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,23 @@
func Fib1(N); \Return Nth Fibonacci number using iteration
int N;
int Fn, F0, F1;
[F0:= 0; F1:= 1; Fn:= N;
while N > 1 do
[Fn:= F0 + F1;
F0:= F1;
F1:= Fn;
N:= N-1;
];
return Fn;
];
func Fib2(N); \Return Nth Fibonacci number using recursion
int N;
return if N < 2 then N else Fib2(N-1) + Fib2(N-2);
int N;
[for N:= 0 to 20 do [IntOut(0, Fib1(N)); ChOut(0, ^ )];
CrLf(0);
for N:= 0 to 20 do [IntOut(0, Fib2(N)); ChOut(0, ^ )];
CrLf(0);
]