program 1
100 REM DIVISION
200 PRINT “DIVIDEND”, “DIVISOR”, “QUOTIENT”
300 PRINT
400 READ A,B
500 IF A = 99 THEN 1000
550 LET C = A/B
600 PRINT A,B,C
700 GO TO 400
800 DATA 6,3,12,4,25,5,16,8
900 DATA 63,9,36,6,30,5,8,2
999 DATA 99,99
1000 END
Results:
|
DIVIDEND
|
DIVISOR
|
QUOTIENT
|
6
|
3
|
2
|
Explanation—program 1
-
Line 200 Teaches the student what the terms in division are called. The column print out also helps to define them.
-
Line 500 When A is being read in the data statement as 99 the program will automatically end.
program 2
10 REM FIND THE MILES PER GALLON
20 PRINT “TYPE IN MILES AND GALLONS”
30 INPUT M,G
40 IF M = 99 THEN 90
50 LET P = M/G
60 PRINT “MILES=”; M; “GALLONS=”; G
70 PRINT “MPG=”; P
80 GO TO 30
90 END
Results:
TYPE IN MILES AND GALLONS
MFG = 30
Explanation—program 2
-
Line 60 A “PRINT” statement with the equal sign after it allows for the variable to have a label. I used a semicolon to keep the spacing close together.
-
Line 70 I used another “PRINT” statement so the answer to the formula would show below the numbers