10 REM "ADD 1.6, COPYRIGHT 1983"
30 REM "By SmallSoft"
35 CLS$=CHR$(26):CH$=CHR$(27)
40 PRINT CHR$(26):FOR I=1 TO 7:PRINT:NEXT
50 PRINT "        WELCOME TO ADDition ";USER$
80 PRINT:PRINT "Yes, this is ADDition. In this sub-program of"
90 PRINT "KIDMATH you will be able to work addition problems"
100 PRINT "at any of five (5) levels of hardness."
105 COMMON SEED
110 CHAIN MERGE "GRAPHIC",360,ALL
360 PRINT CHR$(26):PRINT
363 PRINT TAB(18);"LEVEL MENU
366 FOR I=1 TO 4:PRINT:NEXT
370 PRINT "     First, ";USER$;", pick the level of hard-"
380 PRINT "     ness you want from the five choices"
390 PRINT "     shown below. Or, you may EXIT back to"
400 PRINT "     the original KIDMATH program."
410 PRINT
420 PRINT "      1 > LEVEL 1 (Single whole numbers)
430 PRINT "      2 > LEVEL 2 (Complex whole numbers)
440 PRINT "      3 > LEVEL 3 (Complex decimal numbers)
450 PRINT "      4 > LEVEL 4 (Simple fractions)"
460 PRINT "      5 > LEVEL 5 (Complex fractions)"
510 PRINT "      E > EXIT, to KIDMATH"
520 PRINT:PRINT "             TYPE in your CHOICE?";
535 H$=INPUT$(1)
536 IF H$="E" OR H$="e"  THEN PRINT:PRINT:PRINT "           WAIT!! Returning to KIDMATH":CHAIN "KM",970,ALL
537 H=VAL(H$)
539 PRINT CHR$(26)
540 IF H<=0 OR H>=6 THEN PRINT CHR$(7):FOR I=1 TO 6:PRINT:NEXT I:PRINT"    The number must be between 1 and 5, or E":FOR I=1 TO 1500:NEXT I:GOTO 360
550 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT:PRINT "Now, ";USER$;", you must pick whether you want REGULAR"
560 PRINT "DRILL or TEST for a possible REWARD."
570 PRINT:PRINT:PRINT:PRINT "          A >  REGULAR DRILL"
580 PRINT "          B >  TEST and/or REWARD (20 problems)"
590 PRINT:PRINT:PRINT "             TYPE in your CHOICE?";
600 KK$=INPUT$(1):IF KK$<>"A" AND KK$<>"a" AND KK$<>"B" AND KK$<>"b" THEN PRINT CHR$(26)CHR$(7):PRINT "   Your CHOICE must be either 'A' or 'B' ONLY.":FOR I=1 TO 1500:NEXT:GOTO 550
605 IF KK$="a" THEN KK$="A":IF KK$="b" THEN KK$="B"
607 IF KK$="b" THEN KK$="B"
610 PRINT CHR$(26):ON H GOTO 1000,2000,3000,4000,5000
1000 REM "LEVEL 1"
1010 GOSUB 20000
1020 RESTORE:READ A,B
1030 A=INT(RND(A)*10):REM "GENERATES RANDOM NUMBERS"
1040 B=INT(RND(B)*10)
1050 C=A+B
1060 PRINT CHR$(26)
1070 PRINT "PROBLEM NUMBER ";S;".":PRINT:PRINT
1080 PRINT "           ";A
1090 PRINT "          +";B;"       ";A;" + ";B;"="
1100 PRINT "          ___"
1110 GOSUB 40000
1120 PRINT:IF T=C AND KK$="A" THEN GOSUB 62400:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":R=R+1:WWW=0 ELSE IF T=C AND KK$="B" THEN GOSUB 63000:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":GOTO 1150 GOTO 1150
1130 GOSUB 50000
1140 IF T<>C AND WWW=0 THEN GOSUB 62100:W=W+1:WWW=WWW+1:PRINT:PRINT "SORRY!! WRONG answer. Try again.":GOTO 1070 ELSE IF T<>C AND WWW=1 THEN GOSUB 62200:W=W+1:WWW=WWW+1:PRINT:PRINT "SORRY!! WRONG answer. Try again.":GOTO 1070
1150 IF KK$="B" AND R=20 THEN 1170 ELSE GOSUB 60000
1160 IF X$<>"S" THEN S=S+1:GOTO 1020 ELSE PRINT CHR$(26)CHR$(7):GOTO 1150
1170 PRINT "  You had ";R;" RIGHT ANSWERS and ";W;" WRONG ANSWERS"
1175 IF KK$="A" THEN PRINT "             Press <RETURN> to CONTINUE"
1180 PRINT " Press L for new LEVEL, A for new AREA,  Q to QUIT";
1185 Y$=INPUT$(1):IF Y$=CHR$(13) THEN 610 ELSE IF Y$="L" OR Y$="l" THEN 360 ELSE IF Y$="Q" OR Y$="q" THEN SYSTEM ELSE SEED=SEED+1:COMMON SEED:CHAIN "KM",970,ALL
1240 END
2000 REM "LEVEL 2"
2010 GOSUB 20000
2020 GOSUB 30000
2030 RESTORE:READ A,B,C,D,E
2040 A=INT(RND(A)*100):REM "GENERATES RANDOM NUMBERS"
2050 B=INT(RND(B)*100)
2060 C=INT(RND(C)*100)
2070 D=INT(RND(D)*100)
2080 E=INT(RND(F)*100)
2090 FOR I=1 TO 3
2100 IF A<10 THEN A=A*10:REM "MAKES ALL NUMBERS FALL BETWEEN 10-99
2110 IF B<10 THEN B=B*10
2120 IF C<10 THEN C=C*10
2130 IF D<10 THEN D=D*10
2140 IF E<10 THEN E=E*10
2150 NEXT
2160 F=A+B+C+D+E
2170 PRINT CHR$(26)
2180 PRINT "PROBLEM NUMBER ";S;".":PRINT:PRINT
2190 PRINT "      ";
2200 PRINT USING O$;A
2210 PRINT "      ";
2220 PRINT USING O$;B
2230 PRINT "      ";
2240 PRINT USING O$;C
2250 PRINT "      ";
2260 PRINT USING O$;D
2270 PRINT "    + ";    
2280 PRINT USING O$;E;      
2290 PRINT "   ";A;"+";B;"+";C;"+";D;"+";E;"="
2300 PRINT "     ____
2310 GOSUB 40000
2320 PRINT:IF T=F AND KK$="A" THEN GOSUB 62400:PRINT:PRINT USER$;" Your ANSWER ";F; " is CORRECT!!!":WWW=0:R=R+1 ELSE IF T=F AND KK$="B" THEN GOSUB 63000:PRINT:PRINT USER$;" Your ANSWER ";F;" is CORRECT!!!":GOTO 2350
2330 GOSUB 50000
2340 IF T<>F AND WWW=0 THEN GOSUB 62100:W=W+1:WWW=WWW+1:PRINT:PRINT "SORRY!! WRONG answer. Try again.":GOTO 2180 ELSE IF T<>F AND WWW=1 THEN GOSUB 62200:W=W+1:WWW=WWW+1:PRINT:PRINT "SORRY!! WRONG answer. Try again.":PRINT:GOTO 2180
2350 IF KK$="B" AND R=20 THEN 1170 ELSE GOSUB 60000
2360 IF X$<>"S" THEN S=S+1:GOTO 2030 ELSE PRINT CHR$(26)CHR$(7):GOTO 2350
2370 END
3000 REM "LEVEL 3"
3010 GOSUB 20000
3020 GOSUB 30000
3030 RESTORE:READ A,B,C,D
3040 A=(INT(RND(A)*100000!)/10):REM: "GENERATES RANDOM NUMBERS"
3050 B=(INT(RND(B)*100000!)/10)
3060 C=(INT(RND(C)*100000!)/10)
3070 D=(INT(RND(D)*100000!)/10)
3080 FOR I=1 TO 5
3090 IF A<1000 THEN A=A*10+.3 :REM: "KEEPS ALL NUMBERS BETWEEN 100.0-999.9
3100 IF B<1000 THEN B=B*10+.6 
3110 IF C<1000 THEN C=C*10+.2
3120 IF D<1000 THEN D=D*10+.9 
3130 NEXT
3140 E=A+B+C+D
3150 E=(INT(E*10))/10:REM "STRIPS OFF ROUND-UP/DOWN"
3160 PRINT CHR$(26)
3170 PRINT "PROBLEM NUMBER ";S;".":PRINT:PRINT
3180 PRINT "  ";
3190 PRINT USING P$;A
3200 PRINT "  ";
3210 PRINT USING P$;B
3220 PRINT "  ";
3230 PRINT USING P$;C
3240 PRINT "+ ";
3250 PRINT USING P$;D;
3260 PRINT "    ";A;"+";B;"+";C;"+";D;"="
3270 PRINT "________"
3280 GOSUB 40000
3290 PRINT:IF T=E AND KK$="A" THEN GOSUB 62400:PRINT:PRINT USER$;" Your ANSWER ";E;" is CORRECT!!!":WWW=0:R=R+1 ELSE IF T=E AND KK$="B" THEN GOSUB 63000:PRINT:PRINT USER$;" Your ANSWER ";E;" is CORRECT":GOTO 3320
3300 GOSUB 50000
3310 IF T<>E AND WWW=0 THEN GOSUB 62100:W=W+1:WWW=WWW+1:PRINT:PRINT "SORRY!! WRONG answer. Try again.":GOTO 3170 ELSE IF T<>E AND WWW=1 THEN GOSUB 62200:W=W+1:WWW=WWW+1:PRINT:PRINT "SORRY!! WRONG answer. Try again.":GOTO 3170
3320 IF KK$="B" AND R=20 THEN 1170 ELSE GOSUB 60000
3330 IF X$<>"S" THEN S=S+1:GOTO 3030 ELSE PRINT CHR$(26)CHR$(7):GOTO 3320
3340 END
4000 REM "LEVEL 4"
4010 GOSUB 20000
4020 GOSUB 30000
4030 RESTORE:READ A,B,C,D
4040 A=INT(RND(A)*1000):B=INT(RND(B)*1000):C=INT(RND(C)*1000):D=INT(RND(D)*1000)
4050 IF A=0 OR B=0 OR C=0 OR D=0 THEN 4030
4060 FOR I=1 TO 5
4070 IF A>=10 THEN A=INT(A/10)
4080 IF B>=10 THEN B=INT(B/10)
4090 IF C>=10 THEN C=INT(C/10)
4100 IF D>=10 THEN D=INT(D/10)
4110 NEXT I
4120 IF A>B THEN SWAP A,B
4130 IF C>D THEN SWAP C,D
4140 F=B*D
4150 E=(F/B)*A
4160 G=(F/D)*C
4170 H=E+G
4180 Y=H:Z=F
4190 J=9
4200 WHILE J>=1
4210 FOR K=1 TO 3
4220 IF H/J=INT(H/J) AND F/J=INT(F/J) THEN L=H/J:M=F/J:H=L:F=M
4230 NEXT K
4240 J=J-1
4250 WEND
4260 IF L/M=INT(L/M) THEN 4030
4270 O=INT(L/M)
4280 P=L-(O*M)
4290 IF P=0 THEN M=0
4300 PRINT CHR$(26)
4310 PRINT "PROBLEM NUMBER ";S;".":PRINT
4320 PRINT "    ";A;"   ";C
4330 PRINT "    ___ + ___  ="
4340 PRINT "    ";B;"   ";D
4350 PRINT:PRINT "Your ANSWER will be in THREE PARTS, each SEPARATED
4360 PRINT "by a COMMA ','. First,ENTER the WHOLE NUMBER"
4370 PRINT "(0 IF NONE), then the NUMERATOR and finally the
4380 PRINT "DENOMINATOR.                                15
4390 PRINT "(EXAMPLE: 3,15,16 would be entered for  3  ___ )"
4400 PRINT "                                            16"
4410 PRINT:PRINT "Be sure to REDUCE your ANSWER to the LOWEST form"
4420 PRINT "POSSIBLE."
4430 PRINT:INPUT "Do this NOW! (Then press RETURN/ENTER)";T,U,V
4440 PRINT: IF T=O AND U=P AND V=M AND KK$="A" THEN GOSUB 62400:PRINT:PRINT "Your WHOLE NUMBER";T;"NUMERATOR";U;"and DENOMINATOR";V;CHR$(10)CHR$(13);"are all CORRECT ";USER$;" !!":R=R+1:WWW=0:GOTO 4510
4450 PRINT: IF T=O AND U=P AND V=M AND KK$="B" THEN GOSUB 63000:PRINT:PRINT "Your WHOLE NUMBER";T;"NUMERATOR";U;"and DENOMINATOR";V;CHR$(10)CHR$(13);"are all CORRECT ";USER$;" !!":GOTO 4820
4460 IF WWW=2 THEN GOSUB 62300:PRINT:PRINT "SORRY!! you missed the same problem 3 times. Look";CHR$(10)CHR$(13);"at the right answer.":PRINT:W=W+1:PRINT:GOTO 4510 
4470 IF T<>O OR U<>P OR V<>M THEN W=W+1:WWW=WWW+1
4480 IF WWW=1 THEN GOSUB 62100:PRINT:PRINT "SORRY!! WRONG answer. Try again." ELSE IF WWW=2 THEN GOSUB 62200:PRINT:PRINT "SORRY!! WRONG answer. Try again."
4490 IF T=0 AND U=Y AND V=Z AND Z<>M THEN PRINT "Your NUMERATOR";Y;"and DENOMINATOR";Z;"are CORRECT,";CHR$(10)CHR$(13);"but you DID NOT REDUCE far enough.":PRINT:GOTO 4310
4500 IF T=0 AND U=L AND V=M AND L>M THEN PRINT "Your NUMERATOR";L;"and DENOMINATOR";M;"are CORRECT,";CHR$(10)CHR$(13);"but,you forget to MAKE your ANSWER a WHOLE ";CHR$(10)CHR$(13);"NUMBER and FRACTION.":PRINT:GOTO 4310 ELSE GOTO 4310
4510 PRINT
4520 PRINT USING N$;A;
4530 PRINT "   ";
4540 PRINT USING N$;C;
4550 PRINT "   ";
4560 PRINT USING Q$;E;
4570 PRINT "   ";
4580 PRINT USING Q$;G;
4590 PRINT "   ";
4600 PRINT USING Q$;Y;
4610 PRINT "    ";
4620 PRINT USING Q$;L;
4630 PRINT "       ";
4640 PRINT USING Q$;P
4650 PRINT "_ + _ = ___ + ___ = ___ or ___ or  ";
4660 PRINT USING O$;O;
4670 PRINT " __"
4680 PRINT USING N$;B;
4690 PRINT "   ";
4700 PRINT USING N$;D;
4710 PRINT "   ";
4720 PRINT USING Q$;Z;
4730 PRINT "   ";
4740 PRINT USING Q$;Z;
4750 PRINT "   ";
4760 PRINT USING Q$;Z;
4770 PRINT "    ";
4780 PRINT USING Q$;M;
4790 PRINT "       ";
4800 PRINT USING Q$;M
4810 IF WWW=2 THEN PRINT:PRINT:GOTO 1170
4820 IF KK$="B" AND R=20 THEN 1170 ELSE GOSUB 60000
4830 IF X$<>"S" THEN S=S+1:GOTO 4020 ELSE PRINT CHR$(26)CHR$(7):GOTO 4820
5000 REM "LEVEL 5"
5010 GOSUB 20000
5020 GOSUB 30000
5030 RESTORE:READ A,B,C,D
5040 A=INT(RND(A)*1000):B=INT(RND(B)*1000):C=INT(RND(C)*1000):D=INT(RND(D)*1000)
5050 IF A=0 OR B=0 OR C=0 OR D=0 THEN 5030
5060 FOR I=1 TO 5
5070 IF A>=100 THEN A=INT(A/10)
5080 IF B>=100 THEN B=INT(B/10)
5090 IF C>=100 THEN C=INT(C/10)
5100 IF D>=100 THEN D=INT(D/10)
5110 NEXT I
5120 IF A>B THEN SWAP A,B
5130 IF C>D THEN SWAP C,D
5140 F=B*D
5150 E=(F/B)*A
5160 G=(F/D)*C
5170 H=E+G
5180 Y=H:Z=F
5190 J=9
5200 WHILE J>=1
5210 FOR K=1 TO 4
5220 IF H/J=INT(H/J) AND F/J=INT(F/J) THEN L=H/J:M=F/J:H=L:F=M
5230 NEXT K
5240 J=J-1
5250 WEND
5260 IF L/M=INT(L/M) THEN 5030
5270 O=INT(L/M)
5280 P=L-(O*M)
5290 IF P=0 THEN M=0
5300 PRINT CHR$(26)
5310 PRINT "PROBLEM NUMBER ";S;".":PRINT
5320 PRINT "    ";A;"    ";C
5330 PRINT "    ___  +  ___  ="
5340 PRINT "    ";B;"    ";D
5350 PRINT:PRINT "Your ANSWER will be in THREE parts, each SEPARATED
5360 PRINT "by a COMMA ','. First ENTER the WHOLE NUMBER"
5370 PRINT "(0 IF NONE), then the NUMERATOR and finally the
5380 PRINT "DENOMINATOR.                                15
5390 PRINT "(EXAMPLE: 3,15,16 would be entered for  3  ___ )"
5400 PRINT "                                            16"
5410 PRINT:PRINT "Be sure to REDUCE your ANSWER to the LOWEST form"
5420 PRINT "possible."
5430 PRINT:INPUT "Do this NOW! (then PRESS RETURN/ENTER)";T,U,V
5440 PRINT: IF T=O AND U=P AND V=M AND KK$="A" THEN GOSUB 62400:PRINT:PRINT "Your WHOLE NUMBER";T;"NUMERATOR";U;"and DENOMINATOR";V;CHR$(10)CHR$(13);"are all CORRECT ";USER$;" !!":R=R+1:WWW=0:GOTO 5510
5450 PRINT: IF T=O AND U=P AND V=M AND KK$="B" THEN GOSUB 63000:PRINT:PRINT "Your WHOLE NUMBER";T;"NUMERATOR";U;"and DENOMINATOR";V;CHR$(10)CHR$(13);"are all CORRECT ";USER$;"  !!":GOTO 5820
5460 IF WWW=2 THEN GOSUB 62300:PRINT:PRINT "SORRY!! You missed the same problem 3 times. Look";CHR$(10)CHR$(13);"at the right answer.":PRINT:W=W+1:PRINT:GOTO 5510 
5470 IF T<>O OR U<>P OR V<>M THEN W=W+1:WWW=WWW+1
5480 IF WWW=1 THEN GOSUB 62100:PRINT:PRINT "SORRY!! WRONG answer. Try again." ELSE IF WWW=2 THEN GOSUB 62200:PRINT:PRINT "SORRY!! WRONG answer. Try again."
5490 IF T=0 AND U=Y AND V=Z AND Z<>M THEN PRINT "Your NUMERATOR";Y;"and DENOMINATOR";Z;"are CORRECT,";CHR$(10)CHR$(13);"but you DID NOT REDUCE far enough.":PRINT:GOTO 5310
5500 IF T=0 AND U=L AND V=M AND L>M THEN PRINT "Your NUMERATOR";L;"and DENOMINATOR";M;"are CORRECT,";CHR$(10)CHR$(13);"but you forgot to make your ANSWER a WHOLE ";CHR$(10)CHR$(13);"NUMBER and FRACTION.":PRINT:GOTO 5310 ELSE GOTO 5310
5510 PRINT
5520 PRINT USING O$;A;
5530 PRINT "   ";
5540 PRINT USING O$;C;
5550 PRINT "   ";
5560 PRINT USING R$;E;
5570 PRINT "   ";
5580 PRINT USING R$;G;
5590 PRINT "   ";
5600 PRINT USING R$;Y;
5610 PRINT "    ";
5620 PRINT USING R$;L;
5630 PRINT "         ";
5640 PRINT USING R$;P
5650 PRINT "__ + __ = ____ + ____ = ____ or ____ or ";
5660 PRINT USING Q$;O;
5670 PRINT "  ____"
5680 PRINT USING O$;B;
5690 PRINT "   ";
5700 PRINT USING O$;D;
5710 PRINT "   ";
5720 PRINT USING R$;Z;
5730 PRINT "   ";
5740 PRINT USING R$;Z;
5750 PRINT "   ";
5760 PRINT USING R$;Z;
5770 PRINT "    ";
5780 PRINT USING R$;M;
5790 PRINT "         ";
5800 PRINT USING R$;M
5810 IF WWW=2 THEN PRINT:PRINT:GOTO 1170
5820 IF KK$="B" AND R=20 THEN 1170 ELSE GOSUB 60000
5830 IF X$<>"S" THEN S=S+1:GOTO 5020 ELSE PRINT CHR$(26)CHR$(7):GOTO 5820
6000 GOTO 360
7000 GOTO 360
8000 GOTO 360
9000 GOTO 360
10000 REM "DATA & SUB-ROUTINES"
10010 DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
10020 DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-999
20000 RANDOMIZE SEED
20010 R=0:       REM "INITIALIZE RIGHT ANSWER COUNT
20050 W=0:       REM "INITIALIZE WRONG ANSWER COUNT
20060 WWW=0:     REM "INITIALIZE 3 WRONG ANSWER COUNT
20070 S=1:       REM "INITIALIZE PROBLEM NUMBER COUNT
20080 RETURN
30000 N$="#":O$="##":P$="####.#":Q$="###":R$="####":RETURN
40000 PRINT:PRINT:INPUT "TYPE in your ANSWER, then press RETURN/ENTER ";T:RETURN
50000 IF WWW=2 THEN GOSUB 62300:PRINT:PRINT "SORRY!! you missed the same problem 3 times.";CHR$(10)CHR$(13);"Maybe you should START OVER or try a LOWER LEVEL.":PRINT:W=W+1:PRINT:GOTO 1170 ELSE RETURN
60000 PRINT:PRINT "Press S for SCORE, ANY other key to CONTINUE?";
60005 X$=INPUT$(1)
60010 IF X$="S" OR X$="s" THEN PRINT CHR$(26):GOTO 1170 ELSE RETURN 
SCORE, ANY other key to CONTINUE?";
60005 X$=INPUT$(1)
60010 IF X$="S" OR X$="s" THEN PRINT CHR$(26):GOTO 1