Count in octal: Difference between revisions

Added ZX81 BASIC
(Added ZX81 BASIC)
Line 292:
190 IF C THEN N$ = "1" + N$
200 GOTO 100</lang>
 
==={{header|Sinclair ZX81 BASIC}}===
The octal number is stored and manipulated as a string, meaning that even with only 1k of RAM the program shouldn't stop until the number gets to a couple of hundred digits long. I have <i>not</i> left it running long enough to find out exactly when it does run out of memory. The <code>SCROLL</code> statement is necessary: the ZX81 halts when the screen is full unless it is positively told to scroll up instead.
<lang basic> 10 LET N$="0"
20 SCROLL
30 PRINT N$
40 LET L=LEN N$
50 LET N=VAL N$(L)+1
60 IF N=8 THEN GOTO 90
70 LET N$(L)=STR$ N
80 GOTO 20
90 LET N$(L)="0"
100 IF L=1 THEN GOTO 130
110 LET L=L-1
120 GOTO 50
130 LET N$="1"+N$
140 GOTO 20</lang>
 
=={{header|Batch File}}==
519

edits