This is a program I wrote to help my daughter practice her multiplication. It asks for the multiplier (any number up to 3276) and then presents 5 problems, randomly choosing a number from 1 to 10. You get two tries to answer correctly. After the second try, the machine gives you the right answer with the next problem. At the end, it displays the number correct and then you can re-execute the program. This program uses 1K memory, so you can add more descriptive information as memory becomes available.
10 PRINT "HI. WHAT IS YOUR NAME?"
20 INPUT A$
30 CLS
40 PRINT "OK, ";A$;" ENTER MULTIPLIER."
50 INPUT A
60 LET B=0
70 DIM X(5)
80 FOR J=1 TO 5
90 LET C=RND(100)
100 IF C>10 THEN LET C=C/10
110 LET X(J-1)=C
120 GO SUB 500
130 INPUT E
140 FOR L=1 TO 2
150 PRINT E
160 PRINT "THAT IS ";
170 IF NOT E=A*C THEN PRINT "IN";
180 PRINT "CORRECT"
190 IF E=A*C THEN GO TO 250
200 IF L=2 THEN GO TO 260
210 PRINT "PLEASE TRY AGAIN."
220 INPUT E
230 GO SUB 500
240 NEXT L
250 LET B=B+1
260 PRINT "PRESS (NEWLINE) TO CONTINUE"
270 INPUT B$
280 NEXT J
285 LET J=J-1
290 GO SUB 500
300 PRINT A*X(4)
310 IF B>1 THEN GO TO 340
320 PRINT "BETTER TRY AGAIN, ";
330 GO TO 380
340 IF B<5 THEN GO TO 370
350 PRINT "EXCELLENT, ";
360 GO TO 380
370 PRINT "NOT BAD, ";
380 PRINT A$
390 PRINT "YOU GOT ";B;" CORRECT."
400 INPUT B$
410 CLS
420 PRINT "WANT TO TRY AGAIN?"
430 INPUT B$
440 IF CODE(B$)=62 THEN GO TO 30
450 CLS
460 PRINT "OK, ";A$;". THANKS FOR"
470 PRINT "PLAYING WITH ME."
480 PRINT "SEE YOU NEXT TIME."
490 STOP
500 CLS
510 PRINT "MULTIPLY BY ";A
520 FOR K=1 TO J
530 PRINT X(K-1);" X ";A;" = ";
540 IF NOT K=J THEN PRINT X(K-1)*A
550 NEXT K
560 RETURN
SYNTACTIC SUM = -5144
Image Computer Products wants people to write ZX80 programs. For author’s guide, contact Al Baker, program director at Image.
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.