--- title: "Addition Through 7 Digits" id: 76298 type: "computer_media" slug: "addition-through-7-digits" url: "http://localhost/computer_media/addition-through-7-digits/" markdown_url: "http://localhost/computer_media/addition-through-7-digits.md" published_at: "2026-11-11T08:03:14+00:00" modified_at: "2026-11-11T08:03:14+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/addition-through-7-digits-1.png" excerpt: "Add up numbers of up to seven digits on the ZX80, getting around its 16-bit integers by keeping each digit in an array." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "ZX80" slug: "zx80" taxonomy: "post_tag" url: "http://localhost/tag/zx80/" model: - name: "Sinclair ZX80" slug: "zx80" taxonomy: "model" url: "http://localhost/model/zx80/" indiv: - name: "Francis LeBaron" slug: "francis-lebaron" taxonomy: "indiv" url: "http://localhost/indiv/francis-lebaron/" genre: - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_type: "Program" programmers: - name: "Francis LeBaron" slug: "francis-lebaron" taxonomy: "indiv" url: "http://localhost/indiv/francis-lebaron/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Addition%20Through%207%20Digits%20%281981%29%28LeBaron%2C%20Francis%29%28ZX80%29%28US%29%28Program%29.zip" mediadate: "1981" images: - url: "http://localhost/wp-content/uploads/2026/11/addition-through-7-digits-1.png" - url: "http://localhost/wp-content/uploads/2026/11/addition-through-7-digits-2.png" article_media: - id: 19245 title: "Addition Through 7 Digits" type: "article" url: "http://localhost/article/addition-through-7-digits/" related_content: - id: 19792 title: "Syns of Omission" type: "article" url: "http://localhost/article/syns-of-omission-2/" media_type_tags: "Mathematics" license: false --- # Addition Through 7 Digits The 4K ZX80 handles whole numbers only up to 32767. This program keeps a running total of seven digits, one digit per array element, and does the carrying itself. Enter a number of up to seven digits and press NEWLINE; enter another and the running total appears. As printed, zeros show only as spaces, and a carry is not added correctly. In the March 1981 issue the author added line 225 LET FL=1, which prints zeros inside numbers, and corrected line 140 to LET Y(I+1)=Y(I+1)+1. The download has both versions. The printed Syntactic Sum of the original, 28812, lost its minus sign: the listing sums to -28812. Line 150 jumps to line 95, which does not exist. Published in Syntax February 1981 ([Addition Through 7 Digits](https://timexsinclair.com/article/addition-through-7-digits/)). ## Source Code ``` 5 DIM X(7) 7 DIM Y(7) 10 INPUT A$ 20 FOR N=1 TO 7 30 LET X(N)=CODE(A$)-28 35 IF X(N)<0 THEN GO TO 70 37 IF X(N)>9 THEN STOP 50 LET A$=TL$(A$) 60 NEXT N 70 LET M=N-1 80 FOR I=1 TO N-1 90 LET Y(I)=Y(I)+X(M) 97 IF Y(I)>9 THEN GO TO 130 100 LET M=M-1 110 NEXT I 120 GO TO 200 130 LET Y(I)=Y(I)-10 140 LET Y(I+1)=Y(I)+1 150 GO TO 95 200 LET M=7 202 LET FL=0 210 FOR I=1 TO 7 212 IF FL>0 THEN GO TO 220 214 IF Y(M)=0 THEN GO TO 260 215 LET FL=0 220 PRINT Y(M); 230 LET M=M-1 240 NEXT I 245 PRINT 250 GO TO 10 260 PRINT " "; 270 GO TO 230 ```