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

FracTrace/FTS-Files/Sum50

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/Sum50
Read OK:
File size: 00B6 bytes
Load address: 0000
Exec address: 0000
File contents
\ Sum50
\ Calculates the sum of the first 50 numbers

var count,sum

sum=0
count=1
repeat
 call makesum
 show sum
until count=51
stop

.makesum
 sum=sum+count
 count=count+1
 return
00000000  5c 20 53 75 6d 35 30 0a  5c 20 43 61 6c 63 75 6c  |\ Sum50.\ Calcul|
00000010  61 74 65 73 20 74 68 65  20 73 75 6d 20 6f 66 20  |ates the sum of |
00000020  74 68 65 20 66 69 72 73  74 20 35 30 20 6e 75 6d  |the first 50 num|
00000030  62 65 72 73 0a 0a 76 61  72 20 63 6f 75 6e 74 2c  |bers..var count,|
00000040  73 75 6d 0a 0a 73 75 6d  3d 30 0a 63 6f 75 6e 74  |sum..sum=0.count|
00000050  3d 31 0a 72 65 70 65 61  74 0a 20 63 61 6c 6c 20  |=1.repeat. call |
00000060  6d 61 6b 65 73 75 6d 0a  20 73 68 6f 77 20 73 75  |makesum. show su|
00000070  6d 0a 75 6e 74 69 6c 20  63 6f 75 6e 74 3d 35 31  |m.until count=51|
00000080  0a 73 74 6f 70 0a 0a 2e  6d 61 6b 65 73 75 6d 0a  |.stop...makesum.|
00000090  20 73 75 6d 3d 73 75 6d  2b 63 6f 75 6e 74 0a 20  | sum=sum+count. |
000000a0  63 6f 75 6e 74 3d 63 6f  75 6e 74 2b 31 0a 20 72  |count=count+1. r|
000000b0  65 74 75 72 6e 0a                                 |eturn.|
000000b6