gigatron/rom/Contrib/at67/gbas/tinybasic/Fibonacci.gbas
2025-01-28 19:17:01 +03:00

17 lines
404 B
Plaintext

_runtimePath_ "../runtime"
_codeRomType_ ROMv1
n=0 : j=n : c=j : cls
1 'Fibonacci with bignums
2 dim a(50)=0 : dim b(50)=0 : b(0)=1
3 n=n+1 : print n;": ";
4 for i=0 to j : put b(j-i)+48
5 next i : print : for i=0 to j
6 c=a(i)+b(i)+c : a(i)=b(i)
7 b(i)=c : if c &&< 10 then c=0 : goto 9
8 b(i)=c-10 : c=1
9 next i : if c &&= 0 then goto &12
10 j=j+1 : if j &&= 50 then END
11 a(j)=0 : b(j)=c
12 goto 3