BASIC MATHS (16K ZX-81)
by Raymond Blake
from Popular Computing Weekly Vol. 2 No. 15 (14 April 1983), pages 29-30

Maths runs on the 16K ZX81 and attempts to teach children in the range of
5-7 years the basic principles of addition and subtraction.

The program is extremely user-friendly and actually sets out each sum as a
child of that age would on paper, including carry digits, which the computer is
intelligent enough to ignore, and not request, if not necessary in a particular
sum.

The program will not set a sum producing a negative number, which would confuse
the child, and the sum is set out correctly after he has answered, so that he
can see where he made a mistake. After 10 sums, the child is told how well he
did and given the option of more (no, it isn't a stupid question; all the
subjects I tested the routine on reached for the Y key).

The sum may be more difficult for an adult to answer than a child, as it
employs the techniques a young child would use. Yes, I do remember as I am only
15 years old). First the product (or subtractive remainder) of the units
column, then the carry digit (the computer will not request one if not
necessary) and finally the product of the tens column (likewise, if not
necessary, it will not be requested).

Answering is, for the child, simplicity itself, as a cursor (inverse '?') marks
the spot where the next particular digit belongs in the answer. Upon running,
this will be made clear (it is not described in words).


PROGRAM NOTES

50-650     Main program loop
80-110     Addition or subtraction sum? Two numbers?
120        Does sum produce a negative answer?
130-160    Calculates answer and converts numbers and answer to strings
180-200    Prints out sum and requests answer
250-500    Prints cursor in appropriate place, bug checks and prints Inkey$
500-560    Right or wrong?
580-600    Prints out correct sum and increments score if necessary
620-650    If not last sum, back to start of loop
680-770    If last sum, print results and rating
750-999    Does pupil want more sums?
1000-1130  Introductions subroutine (N$=pupil's name)