gno/usr.bin/awk/tests/out2/sum.list.out
tribby 0b6d503134 awk 2.0 for GNO/ME, including modified Bell Labs source code, test cases,
and output files for test case comparison. See README.gno for implementation
notes. NOTE: some test cases in tests/dotests are commented-out because
they depend on pipes working and/or the "sort" utility.
1998-04-07 16:19:01 +00:00

13 lines
528 B
Plaintext

0: 03010 ld zero # initialize sum to zero
1: 04011 st sum
2: 01000 loop get # read a number
3: 08007 jz done # no more input if number is zero
4: 05011 add sum # add in accumulated sum
5: 04011 st sum # store new value back in sum
6: 09002 j loop # go back and read another number
7: 03011 done ld sum # print sum
8: 02000 put
9: 10000 halt
10: 00000 zero const 0
11: 00000 sum const