Home » Archimedes archive » Micro User » MU 1991-09.adf » PD-Stuff » FracTrace/FTS-Files/Fibonacci

FracTrace/FTS-Files/Fibonacci

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Micro User » MU 1991-09.adf » PD-Stuff
Filename: FracTrace/FTS-Files/Fibonacci
Read OK:
File size: 00C8 bytes
Load address: 0000
Exec address: 0000
File contents
\ Fibonacci
\ Calculates the first 20 numbers 
\ in the Fibonacci sequence

var old,veryold,new,count

veryold=0
old=1       
for count=1 to 20
 new=veryold+old
 veryold=old
 old=new
 show new
endfor
00000000  5c 20 46 69 62 6f 6e 61  63 63 69 0a 5c 20 43 61  |\ Fibonacci.\ Ca|
00000010  6c 63 75 6c 61 74 65 73  20 74 68 65 20 66 69 72  |lculates the fir|
00000020  73 74 20 32 30 20 6e 75  6d 62 65 72 73 20 0a 5c  |st 20 numbers .\|
00000030  20 69 6e 20 74 68 65 20  46 69 62 6f 6e 61 63 63  | in the Fibonacc|
00000040  69 20 73 65 71 75 65 6e  63 65 0a 0a 76 61 72 20  |i sequence..var |
00000050  6f 6c 64 2c 76 65 72 79  6f 6c 64 2c 6e 65 77 2c  |old,veryold,new,|
00000060  63 6f 75 6e 74 0a 0a 76  65 72 79 6f 6c 64 3d 30  |count..veryold=0|
00000070  0a 6f 6c 64 3d 31 20 20  20 20 20 20 20 0a 66 6f  |.old=1       .fo|
00000080  72 20 63 6f 75 6e 74 3d  31 20 74 6f 20 32 30 0a  |r count=1 to 20.|
00000090  20 6e 65 77 3d 76 65 72  79 6f 6c 64 2b 6f 6c 64  | new=veryold+old|
000000a0  0a 20 76 65 72 79 6f 6c  64 3d 6f 6c 64 0a 20 6f  |. veryold=old. o|
000000b0  6c 64 3d 6e 65 77 0a 20  73 68 6f 77 20 6e 65 77  |ld=new. show new|
000000c0  0a 65 6e 64 66 6f 72 0a                           |.endfor.|
000000c8