MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues. 2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)

MULTDIV

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search
100 DIM LM(5,2), MS$(5)
110 DATA 0,9,10,99,100,999,1000,9999,10000,99999
120 DATA "GOOD WORK!","KEEP IT UP!","NICE GOING!","YOU'RE DOING GREAT"
130 DATA "FANTASTIC!"
140 FOR T=1 TO 5
150 READ LM(T,1), LM(T,2): NEXT T
160 FOR T=1 TO 5
170 READ MS$(T): NEXT T
180 CLS
190 PRINT@1,"MULTIPLICATION/DIVISION PROGRAM"
200 PRINT@64,"SELECT ONE OF THE FOLLOWING:"
210 PRINT@96,"A. MULTIPLICATION"
220 PRINT@128,"B. DIVISION"
230 PRINT@160,"WHICH ONE";: INPUT AS
240 IF A$="A" THEN 290
250 IF A$="B" THEN 430
260 PRINT@224,"INVALID SELECTION--TRY AGAIN"
270 FOR T1 TO 300: NEXT T
280 PRINT@224,"";: PRINT: PRINT@171,"": GOTO230
290 REM MULTIPLICATION
300 C=1: T1=0: T2=0
310 IF C<3 THEN D=1: GOTO330
320 D=C-1
330 A1=RND(LM(C,2)): A2=RND(LM(D,2))
340 IF (A1<LM(C,1)) OR (A2<LM(D,1)) THEN 330
350 A3=A1*A2
360 B$=STR$(A1): C$=STR$(A3): D$=STR$(A2)
370 CLS
380 PRINT@9,"MULTIPLICATION": PRINT@166,"*"
390 PRINT@135,A1: PRINT@167+(LEN(B$)-LEN(D$)),A2
400 PRINT@198,"-------"
410 PRINT@230(LEN(C$)-LEN(B$))";: INPUT T
420 GOSUB570: GOTO310
430 REM DIVISION
440 C=1: T1=0: T2=0
430 IF C<3 THEN D=1: GOTO470
460 D=C-1
470 A1=RND(LM(C,2)): A2=RND(LM(D,2))
480 IF (A1<LM(C,1)) OR (A2<LM(D,1)) OR (A1<A2) THEN 470
490 A3=INT(A1/A2)
500 R1=A1-(A2*A3)
510 CLS
520 PRINT@12,"DIVISION"
530 PRINT@161,A1 ;"/";A2
540 PRINT@173,"Q=";: INPUT T
530 PRINT@207,"R=";: INPUT R
560 GOSUB570: GOTO450
570 REM PRINT SUBROUTINE
580 T2=T2+1
590 IF A$="B" THEN 620
600 IF T=A3 THEN 640
610 PRINT@320,"WRONG! THE ANSWER IS";A3; GOTO670
620 IF (T=A3) AND (R=R1) THEN 640
630 PRINT@320,"WRONG! ANSWER IS Q";A3;"R";R1: GOTO670
640 T1=T1+1
630 IF ((T2/10)=INT(T2/10)) AND ((T1/T2)>.60) THEN PRINT@238,MS$(C)
660 PRINT@320,"CORRECT!";T1;"OUT OF";T2
670 PRINT@384,"ENTER H FOR HARDER, E FOR"
680 PRINT@416,"EASIER, R FOR RESTART, OR"
690 PRINT@448,"JUST <ENTER> FOR SAME";: INPUT B$
700 IF B$="R" THEN 180
710 IF B$="" THEN 750
720 IF (B$="E") AND (C>1) THEN C=C-1: GOTO750
730 IF (B$="H") AND (C<3) THEN C=C+1: GOTO750
740 GOTO670
730 RETURN