10 REM "MUL 1.6, COPYRIGHT 1983"
30 REM "By SmallSoft"
40 CLS$=CHR$(26):CH$=CHR$(27)
50 PRINT CHR$(26):FOR I=1 TO 7:PRINT:NEXT
60 PRINT "    WELCOME TO MULtiplication ";USER$
90 PRINT:PRINT "Yes, this is MULtiplication. In this sub-program of"
100 PRINT "KIDMATH you will be able to work multiplication "
110 PRINT "problems at any of five (5) levels of hardness."
115 COMMON SEED
120 CHAIN MERGE "GRAPHIC",370,ALL
290 IF B>10 THEN B=5+(INT(B/10))
370 PRINT CHR$(26):PRINT
373 PRINT TAB(18);"LEVEL MENU
376 FOR I=1 TO 4:PRINT:NEXT
380 PRINT "     First, ";USER$;", you must pick the level of "
390 PRINT "     hardness you want from the five"
400 PRINT "     choices available. Or, you may exit back"
410 PRINT "     the original KIDMATH program."
420 PRINT
430 PRINT "      1 > LEVEL 1 (Single whole numbers)"
440 PRINT "      2 > LEVEL 2 (Complex whole numbers)"
450 PRINT "      3 > LEVEL 3 (Complex decimal numbers) "
460 PRINT "      4 > LEVEL 4 (Simple fractions)"
470 PRINT "      5 > LEVEL 5 (Complex fractions)"
520 PRINT "      E > EXIT, to KIDMATH"
530 PRINT:PRINT "            Type in your CHOICE?";
532 H$=INPUT$(1)
534 IF H$="E" OR H$="e" THEN PRINT:PRINT:PRINT "          WAIT!! Returning to KIDMATH":CHAIN "KM",970,ALL
536 H=VAL(H$)
540 PRINT CHR$(26)
550  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 370
560 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT:PRINT "Now, ";USER$;",  you must pick whether you want REGULAR"
570 PRINT "DRILL or TEST for a possible REWARD."
580 PRINT:PRINT:PRINT:PRINT "         A >  REGULAR DRILL"
590 PRINT "         B >  TEST and/or REWARD (20 problems)
600 PRINT:PRINT:PRINT "          TYPE in your CHOICE?";
602 KK$=INPUT$(1)
610 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 560
615 IF KK$="a" THEN KK$="A" ELSE IF KK$="b" THEN KK$="B"
620 PRINT CHR$(26)
630 ON H GOTO 1000,2000,3000,4000,5000
1000 REM "LEVEL 1"
1010 GOSUB 20000
1020 GOSUB 30000
1030 A=INT((RND(A)*100)/10)
1040 B=INT((RND(B)*100)/10)
1050 C=A*B
1060 PRINT CHR$(26)
1070 PRINT "PROBLEM NUMBER ";S;".":PRINT:PRINT
1080 PRINT "  ";
1090 PRINT USING N$;A
1100 PRINT "x ";
1110 PRINT USING N$;B;
1120 PRINT "     ";A;"x";B;"="
1130 PRINT "___"
1140 GOSUB 40000
1150 PRINT:IF T=C AND KK$="A" THEN GOSUB 62400:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":WWW=0:R=R+1 ELSE IF T=C AND KK$="B" THEN GOSUB 63000:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":GOTO 1180
1160 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.":W=W+1:PRINT:GOTO 1200
1170 IF T<>C AND WWW=0 THEN GOSUB 62100:PRINT:PRINT "SORRY!! WRONG answer. Try again.":WWW=WWW+1:W=W+1:GOTO 1070 ELSE IF T<>C AND WWW=1 THEN GOSUB 62200:PRINT:PRINT "SORRY!! WRONG answer. Try again.":W=W+1:WWW=WWW+1:GOTO 1070
1180 IF KK$="B" AND R=20 THEN 1200 ELSE GOSUB 50000
1190 IF X$<>"S" THEN S=S+1:GOTO 1020 ELSE PRINT CHR$(26)CHR$(7):GOTO 1180
1200 PRINT "  You had ";R; "RIGHT ANSWERS and ";W; "WRONG ANSWERS."
1205 IF KK$="A" THEN PRINT"            Press <RETURN> to CONTINUE"
1210 PRINT " Press L for new LEVEL, A for new AREA,  Q to QUIT";
1215 Y$=INPUT$(1):IF Y$=CHR$(13) THEN 620 ELSE IF Y$="L" OR Y$="l" THEN 370 ELSE IF Y$="Q" OR Y$="q" THEN SYSTEM ELSE SEED=SEED+1:COMMON SEED:CHAIN "KM",970,ALL
2000 REM "LEVEL 2"
2010 GOSUB 20000
2020 GOSUB 30000
2030 A=INT(RND(A)*100)
2040 B=INT(RND(B)*100)
2050 IF B>A THEN 2020
2060 FOR I=1 TO 3
2070 IF A<10 THEN A=A*9
2080 NEXT
2090 IF B>10 THEN B=5+INT(B/10)
2100 C=A*B
2110 D=A*(B-(INT(B/10)*10))
2120 E=A*(INT(B/10))
2130 PRINT CHR$(26)
2140 PRINT "PROBLEM NUMBER ";S;".":PRINT:PRINT
2150 PRINT "  ";
2160 PRINT USING O$;A
2170 PRINT "x ";
2180 PRINT USING O$;B;
2190 PRINT "     ";A;"x";B;"="
2200 PRINT "____"
2210 GOSUB 40000
2220 IF T=C AND KK$="A" THEN GOSUB 62400:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":WWW=0:R=R+1:PRINT:GOTO 2250 ELSE IF T=C AND KK$="B" THEN GOSUB 63000:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":GOTO 2380
2230 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.":W=W+1:PRINT:GOTO 2250
2240 IF T<>C AND WWW=0 THEN GOSUB 62100:PRINT:PRINT "SORRY!! WRONG answer. Try again.":W=W+1:WWW=WWW+1:GOTO 2140 ELSE IF T<>C AND WWW=1 THEN GOSUB 62200:PRINT:PRINT "SORRY!! WRONG answer. Try again":W=W+1:WWW=WWW+1:GOTO 2140
2250 PRINT:PRINT "       ";
2260 PRINT USING O$;A
2270 PRINT "     x ";
2280 PRINT USING O$;B
2290 PRINT "     _____"
2300 PRINT "  ";
2310 PRINT USING Q$;D
2320 PRINT " ";
2330 PRINT USING Q$;E
2340 PRINT "   _______"
2350 PRINT "  ";
2360 PRINT USING Q$;C:PRINT
2370 IF WWW=2 THEN 1200
2380 GOSUB 50000
2390 IF X$<>"S" THEN S=S+1:GOTO 2020 ELSE PRINT CHR$(26)CHR$(7):GOTO 2380
2400 PRINT:PRINT:PRINT:PRINT
2410 INPUT "PRESS ENTER TO RETURN TO MATH ";Y$
2420 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
2430 IF X$="N" THEN PRINT "           WAIT!!! Returning to MATH" 
3000 REM "LEVEL 3"
3010 GOSUB 20000
3020 GOSUB 30000
3030 A=INT(RND(A)*1000)/10
3040 B=INT(RND(B)*1000)/10
3050 IF B>A THEN SWAP B,A
3060 C=A*B
3070 C=(INT(C*100))/100
3080 H=A*10
3090 I=B*10
3100 D=H*(I-(INT(I/10))*10)
3110 E=H*((INT(I/10))-(INT(I/100)*10))
3120 F=H*((INT(I/100))-(INT(I/1000)*10))
3130 G=H*((INT(I/1000))-(INT(I/10000)*10))
3140 PRINT CHR$(26)
3150 PRINT "PROBLEM NUMBER ";S;".":PRINT:PRINT
3160 PRINT "  ";
3170 PRINT USING P$;A
3180 PRINT "x ";
3190 PRINT USING P$;B
3200 PRINT "   _____"
3210 GOSUB 40000
3220 T=(INT(T*100))/100
3230 IF T<=C+.05 AND T>=C-.05 THEN T=C
3240 IF T=C AND KK$="A" THEN GOSUB 62400:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":WWW=0:R=R+1:PRINT :GOTO 3270 ELSE IF T=C AND KK$="B" THEN GOSUB 63000:PRINT:PRINT USER$;" Your ANSWER ";C;" is CORRECT!!!":GOTO 3430
3250 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.":W=W+1:GOTO 3270
3260 IF T<>C AND WWW=0 THEN GOSUB 62100:PRINT:PRINT "SORRY!! WRONG answer. Try again.":W=W+1:WWW=WWW+1:GOTO 3150 ELSE IF T<>C AND WWW=1 THEN GOSUB 62200:PRINT:PRINT "SORRY!! WRONG answer. Try again.":W=W+1:WWW=WWW+1:GOTO 3150
3270 PRINT:PRINT "     ";
3280 PRINT USING P$;A
3290 PRINT " x   ";
3300 PRINT USING P$;B
3310 PRINT "     ______"
3320 PRINT "    ";
3330 PRINT USING Q$;D
3340 PRINT "   ";
3350 PRINT USING Q$;E
3360 PRINT "  ";
3370 PRINT USING Q$;F
3380 PRINT "  _________"
3390 PRINT "    ";
3400 PRINT USING Q$;C*100
3410 PRINT "        /\":PRINT
3420 IF WWW=2 THEN 1200
3430 IF KK$="B" AND R=20 THEN 1200 ELSE GOSUB 50000
3440 IF X$<>"S" THEN S=S+1 :GOTO 3020 ELSE PRINT CHR$(26)CHR$(7):GOTO 3430
4000 REM "LEVEL 4"
4010 GOSUB 20000
4020 RESTORE:READ A,B,C,D
4030 A=INT(RND(A)*1000):B=INT(RND(B)*1000):C=INT(RND(C)*1000):D=INT(RND(D)*1000)
4040 IF A=0 OR B=0 OR C=0 OR D=0 THEN 4020
4050 FOR I=1 TO 5
4060 IF A>=10 THEN A=INT(A/10)
4070 IF B>=10 THEN B=INT(B/10)
4080 IF C>=10 THEN C=INT(C/10)
4090 IF D>=10 THEN D=INT(D/10)
4100 NEXT I
4110 E=A*C
4120 F=B*D
4130 IF E=F THEN 4020
4140 Y=E:Z=F
4150 J=9
4160 WHILE J>=1
4170 FOR K=1 TO 3
4180 IF E/J=INT(E/J) AND F/J=INT(F/J) THEN E=E/J:F=F/J:G=E:H=F
4190 NEXT K
4200 J=J-1
4210 WEND
4220 IF G/H=INT(G/H) THEN 4020
4230 O=INT(G/H)
4240 P=G-(O*H)
4250 PRINT CHR$(26)
4260 PRINT "PROBLEM NUMBER ";S;".":PRINT
4270 PRINT "    ";A;"   ";C
4280 PRINT "    ___ x ___  ="
4290 PRINT "    ";B;"   ";D
4300 PRINT:PRINT "Your ANSWER will be in THREE PARTS, each SEPARATED
4310 PRINT "by a COMMA ','. First ENTER the WHOLE NUMBER"
4320 PRINT "(0 if NONE), then the NUMERATOR and finally the 
4330 PRINT "DENOMINATOR.                                15
4340 PRINT "(EXAMPLE: 3,15,16 would be entered for  3  ___ )"
4350 PRINT "                                            16"
4360 PRINT:PRINT "Be sure to REDUCE your ANSWER to the LOWEST form"
4370 PRINT "POSSIBLE."
4380 PRINT:INPUT "Do this NOW! (Then press RETURN/ENTER)";T,U,V
4390 PRINT: IF T=O AND U=P AND V=H 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 4460
4400 PRINT: IF T=O AND U=P AND V=H 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 4690
4410 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 4460 
4420 IF T<>O OR U<>P OR V<>H THEN :W=W+1:WWW=WWW+1
4430 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."
4440 IF T=0 AND U=Y AND V=Z AND Z<>H THEN PRINT "Your NUMERATOR";Y;"and DENOMINATOR";Z;"are CORRECT,";CHR$(10)CHR$(13);"but you DID NOT REDUCE far enough.":PRINT:GOTO 4260
4450 IF T=0 AND U=G AND V=H AND G>H THEN PRINT "Your NUMERATOR";G;"and DENOMINATOR";H;"are CORRECT,";CHR$(10)CHR$(13);"but you forgot to MAKE your ANSWER a WHOLE ";CHR$(10)CHR$(13);"NUMBER and FRACTION.":PRINT:GOTO 4260 ELSE GOTO 4260
4460 PRINT
4470 PRINT USING N$;A;
4480 PRINT "   ";
4490 PRINT USING N$;C;
4500 PRINT "    ";
4510 PRINT USING S$;Y;
4520 PRINT "    ";
4530 PRINT USING S$;G;
4540 PRINT "       ";
4550 PRINT USING S$;P
4560 PRINT "_ x _ =  ___ or ___ or  ";
4570 PRINT USING O$;O;
4580 PRINT " __"
4590 PRINT USING N$;B;
4600 PRINT "   ";
4610 PRINT USING N$;D;
4620 PRINT "    ";
4630 PRINT USING S$;Z;
4640 PRINT "    ";
4650 PRINT USING S$;H;
4660 PRINT "       ";
4670 PRINT USING S$;H
4680 IF WWW=2 THEN PRINT:PRINT:GOTO 1200
4690 IF KK$="B" AND R=20 THEN 1200 ELSE GOSUB 50000
4700 IF X$<>"S" THEN S=S+1:GOTO 4020 ELSE PRINT CHR$(26)CHR$(7):GOTO 4690 
5000 REM "LEVEL 5"
5010 GOSUB 20000
5020 RESTORE:READ A,B,C,D
5030 A=INT(RND(A)*1000):B=INT(RND(B)*1000):C=INT(RND(C)*1000):D=INT(RND(D)*1000)
5040 IF A=0 OR B=0 OR C=0 OR D=0 THEN 5020
5050 FOR I=1 TO 5
5060 IF A>=100 THEN A=INT(A/10)
5070 IF B>=100 THEN B=INT(B/10)
5080 IF C>=100 THEN C=INT(C/10)
5090 IF D>=100 THEN D=INT(D/10)
5100 NEXT I
5110 E=A*C
5120 F=B*D
5130 IF E=F THEN 5020
5140 Y=E:Z=F
5150 J=9
5160 WHILE J>=1
5170 FOR K=1 TO 4
5180 IF E/J=INT(E/J) AND F/J=INT(F/J) THEN E=E/J:F=F/J:G=E:H=F
5190 NEXT K
5200 J=J-1
5210 WEND
5220 IF G/H=INT(G/H) THEN 5020
5230 O=INT(G/H)
5240 P=G-(O*H)
5250 PRINT CHR$(26)
5260 PRINT "PROBLEM NUMBER ";S;".":PRINT
5270 PRINT "    ";A;"    ";C
5280 PRINT "    ___  x  ___  ="
5290 PRINT "    ";B;"    ";D
5300 PRINT:PRINT "Your ANSWER will be in THREE PARTS, each SEPARATED
5310 PRINT "by a COMMA ','. First ENTER the WHOLE NUMBER"
5320 PRINT "(0 if NONE), then the NUMERATOR and finally the
5330 PRINT "DENOMINATOR.                                15
5340 PRINT "(EXAMPLE: 3,15,16 would be entered for  3  ___ )"
5350 PRINT "                                            16"
5360 PRINT:PRINT "Be sure to REDUCE your ANSWER to the LOWEST form"
5370 PRINT "POSSIBLE."
5380 PRINT:INPUT "Do this NOW! (Then press RETURN/ENTER)";T,U,V
5390 PRINT: IF T=O AND U=P AND V=H 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 5460
5400 PRINT: IF T=O AND U=P AND V=H 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 5710
5410 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 5460 
5420 IF T<>O OR U<>P OR V<>H THEN :W=W+1:WWW=WWW+1
5430 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."
5440 IF T=0 AND U=Y AND V=Z AND Z<>H THEN PRINT "Your NUMERATOR";Y;"and DENOMINATOR";Z;"are CORRECT,";CHR$(10)CHR$(13);"but you DID NOT REDUCE far enough.":PRINT:GOTO 5260
5450 IF T=0 AND U=G AND V=H AND G>H THEN PRINT "Your NUMERATOR";G;"and DENOMINATOR";H;"are CORRECT,";CHR$(10)CHR$(13);"but you forgot to MAKE your ANSWER a WHOLE ";CHR$(10)CHR$(13);"NUMBER and FRACTION.":PRINT:GOTO 5260 ELSE GOTO 5260
5460 PRINT
5470 PRINT "   ";
5480 PRINT USING O$;A;
5490 PRINT "   ";
5500 PRINT USING O$;C;
5510 PRINT "      ";
5520 PRINT USING T$;Y;
5530 PRINT "       ";
5540 PRINT USING T$;G;
5550 PRINT "        ";
5560 PRINT USING T$;P
5570 PRINT "   __ x __   =  ____   or  ____ or  ";
5580 PRINT USING O$;O;
5590 PRINT "  ___"
5600 PRINT "   ";
5610 PRINT USING O$;B;
5620 PRINT "   ";
5630 PRINT USING O$;D;
5640 PRINT "      ";
5650 PRINT USING T$;Z;
5660 PRINT "       ";
5670 PRINT USING T$;H;
5680 PRINT "        ";
5690 PRINT USING T$;H
5700 IF WWW=2 THEN PRINT:PRINT:GOTO 1200
5710 IF KK$="B" AND R=20 THEN 1200 ELSE GOSUB 50000
5720 IF X$<>"S" THEN S=S+1:GOTO 5020 ELSE PRINT CHR$(26)CHR$(7):GOTO 5710 
6000 GOTO 370
7000 GOTO 370
8000 GOTO 370
9000 GOTO 370
10000 REM "DATA & SUB-ROUTINES""
10010 DATA ,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,-999
20000 RANDOMIZE SEED
20040 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 N$="#":O$="##":P$="####.#":Q$="#######":R$="######.##":S$="###":T$="####"
20090 RETURN
30000 RESTORE:READ A,B
30010 IF A=-999 OR B=-999 THEN PRINT CHR$(26):PRINT "OUT OF DATA FOR PROBLEM GENERATION.":GOTO 1200: REM "IF OUT OF DATA, EXIT GRACEFULLY"
30020 RETURN
40000 PRINT:PRINT: INPUT "TYPE in your ANSWER, then press RETURN/ENTER";T:RETURN
50000 PRINT:PRINT "Press S for SCORE, ANY other key to CONTINUE?"
50005 X$=INPUT$(1)
50010 IF X$="S" OR X$="s" THEN PRINT CHR$(26):GOTO 1200 ELSE RETURN
r SCORE, ANY 