home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RBBS in a Box Volume 1 #3.1
/
RBBSIABOX31.cdr
/
medi
/
mathchek.bas
< prev
next >
Wrap
BASIC Source File
|
1990-10-01
|
4KB
|
98 lines
10 REM math corrector by Kenneth H. Mimlitch
20 CLS:WIDTH 40
30 GOSUB 6000
100 REM display menu
110 PRINT"MATH CHECKER"
140 PRINT:PRINT"1-ADDITION (two numbers)"
150 PRINT"2-ADDITION (more than two numbers)
160 PRINT"3-SUBTRACTION
170 PRINT"4-MULTIPICATION"
180 PRINT"5-DIVISION"
182 PRINT"6-SET TO INTEGERS
184 PRINT"7-SET TO FLOATING POINT"
186 PRINT"8-FACTOR"
187 PRINT"9-COMMON FACTORS"
188 PRINT"10-GREATEST COMMON FACTOR"
189 PRINT"11-GREATEST COMMON DENOMINATOR"
190 PRINT:INPUT"WHAT TYPE OF PROBLEM DO YOU HAVE";TYPE
200 IF TYPE<1 OR TYPE>7 THEN CLS:GOTO 110
210 ON TYPE GOSUB 1000,2000,3000,4000,5000,6000,7000,800,900,10000,11000
220 INPUT"CHECK ANOTHER TYPE";A$
230 IF LEFT$(A$,1)="Y" THEN CLS:GOTO 110 ELSE END
1000 REM check addition of two numbers
1010 CLS
1020 PRINT:PRINT:PRINT"ADDITION"
1022 LOCATE 7,10 :PRINT" FIRST NUMBER"
1025 LOCATE 9,8 :PRINT"+ SECOND NUMBER"
1027 LOCATE 10,10 :PRINT"────────────────"
1030 LOCATE 20,1 :INPUT"FIRST NUMBER";NO1
1040 LOCATE 7,10:PRINT USING DEC$;NO1
1050 LOCATE 21,1 :INPUT"SECOND NUMBER";SN
1060 LOCATE 9,10:PRINT USING DEC$;SN
1070 LOCATE 22,1 :INPUT"ANSWER ";AN
1080 LOCATE 11,10:PRINT USING DEC$;AN;
1090 IF NO1+SN=AN THEN PRINT" RIGHT" ELSE PRINT" WRONG"
1100 LOCATE 23,1:INPUT "ANOTHER ADDITION PROBLEM";A$
1110 IF LEFT$(A$,1)="Y" THEN 1000 ELSE RETURN
3000 REM check subtraction of two numbers
3010 CLS
3020 PRINT:PRINT:PRINT"SUBTRACTION"
3022 LOCATE 7,10 :PRINT" FIRST NUMBER"
3025 LOCATE 9,8 :PRINT"- SECOND NUMBER"
3027 LOCATE 10,10 :PRINT"────────────────"
3030 LOCATE 20,1 :INPUT"FIRST NUMBER";NO1
3040 LOCATE 7,10:PRINT USING DEC$;NO1
3050 LOCATE 21,1 :INPUT"SECOND NUMBER";SN
3060 LOCATE 9,10:PRINT USING DEC$;SN
3070 LOCATE 22,1 :INPUT"ANSWER ";AN
3080 LOCATE 11,10:PRINT USING DEC$;AN;
3090 IF NO1-SN=AN THEN PRINT" RIGHT" ELSE PRINT" WRONG"
3100 LOCATE 23,1:INPUT "ANOTHER SUBTRACTION PROBLEM";A$
3110 IF LEFT$(A$,1)="Y" THEN 3000 ELSE RETURN
4000 REM check multiplication of two numbers
4010 CLS
4020 PRINT:PRINT:PRINT"MULTIPICATION"
4022 LOCATE 7,10 :PRINT" FIRST NUMBER"
4025 LOCATE 9,8 :PRINT"* SECOND NUMBER"
4027 LOCATE 10,10 :PRINT"────────────────"
4030 LOCATE 20,1 :INPUT"FIRST NUMBER";NO1
4040 LOCATE 7,10:PRINT USING DEC$;NO1
4050 LOCATE 21,1 :INPUT"SECOND NUMBER";SN
4060 LOCATE 9,10:PRINT USING DEC$;SN
4070 LOCATE 22,1 :INPUT"ANSWER ";AN
4080 LOCATE 11,10:PRINT USING DEC$;AN;
4090 IF NO1*SN=AN THEN PRINT" RIGHT" ELSE PRINT" WRONG"
4100 LOCATE 23,1:INPUT "ANOTHER MULTIPLICATION PROBLEM";A$
4110 IF LEFT$(A$,1)="Y" THEN 4000 ELSE RETURN
5000 REM check multiplication of two numbers
5010 CLS
5020 PRINT:PRINT:PRINT"MULTIPICATION"
5025 LOCATE 10,12:PRINT"┌───────────
5027 LOCATE 11,12 :PRINT"│"
5030 LOCATE 20,1 :INPUT"NUMERATOR";NO1%
5040 LOCATE 11,13:PRINT NO1%
5050 LOCATE 21,1 :INPUT"DENOMINATOR";SN%
5060 LOCATE 11,1:PRINT USING DEC$;SN%
5070 LOCATE 22,1 :INPUT"ANSWER ";AN%:INPUT"REMAINDER";RE%
5080 LOCATE 9,(13+LEN(STR$(NO1%))-LEN(STR$(AN%))):PRINT AN%;" R";RE%;
5090 IF NO1%\SN%=AN% AND NO1% MOD SN%=RE% THEN PRINT" RIGHT" ELSE PRINT" WRONG"
5100 LOCATE 23,1:INPUT "ANOTHER DIVISION PROBLEM";A$
5110 IF LEFT$(A$,1)="Y" THEN 5000 ELSE RETURN
6000 REM set up for integers
6010 DEC$="#########,."
6100 RETURN
7000 REM set up for floating
7010 INPUT"HOW MANY PLACES ";DEC
7020 DEC$="#######,."+STRING$(DEC,"#")
7030 CLS:RETURN 100
8000 REM check factors of a number
8010 CLS
8015 PRINT"FACTORS OF A NUMBER"
8020 LOCATE 3,1
8030 INPUT"FACTOR WHAT NUMBER";NO1%
8040 GOSUB 8500
8500 REM find common factors of NO%
8510 REM FC%=factor count
8520 REM FC%( )=factors
8530 FOR TEST%=2 TO NO%\2