43
50 PRINT “ARITHMETIC OPERATION YOU WANT”
60 PRINT “ME TO DO FOR YOU”
70 INPUT R$
100 IF R$=“A” THEN C=A+B : GOTO 200
110 IF R$=“S” THEN C=A-B : GOTO 200
120 IF R$=“M” THEN C=A*B : GOTO 200
130 IF R$=“D” THEN C=A/B : GOTO 200
140 PRINT “YOU MADE A MISTAKE”
150 PRINT “TRY AGAIN”
160 GOTO 30
200 PRINT “THE ANSWER IS ”;C
300 END
This is a long program but it has a lot of new information that is worthwhile to know. Line
70 contains an INPUT statement without the prompt string. Lines 100 through 130 contain
two statements for the command when the condition is true. One is a LET statement
without the word LET (C=A+B) and the other is a GOTO statement. Both of the statements
are separated from each other by the colon ( : symbol). The GOTO statement tells the
computer the number of the next statement to do. Line 140 is an error trap. It tells you
that you have not followed instructions.
You can experiment some more with this program and put in a decision to start the program
all over again.
If you change line 300 to be GOTO 10, the program runs continually. You can stop it
by pressing the SHIFT and BREAK keys and resume it by typing in CONT and press
ENTER.