Radio Shack TRS-80 Model 100 Basic Manual page 44

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

Delete line 40 by entering just the line number and retype line 30 as follows:
30
INPUT "TIME, NUMBER OF PERIODS" iT, K
~
Then add two new lines:
70
PR
I
NT
(ENTER)
80
GOTO
10
~
List the program to verify that it is:
10
INPUT "PRINCIPAL, RATE"; P, R
30
INPUT "TIME, NUMBER OF PERIODS"; T ,
K
50 5 =
P
*
( 1 +
R
/
K)"(T
*
K )
60
PRINT "TOTAL IS
$" ;
5
70
PRINT
80
GOTO
10
The program will prompt you for values for all four variables, Here is an example of
the output of the program with the following inputs:
PRINCIPAL, RATE?
2000,
. i
L
TIME, NUMBER OF PERIODS? 5, 4
TOTAL IS
$
3979.5777269318
PFHNCI PAL.
RATE?
The program will continue to ask for values for the variables until you terminate the
program manually by pressing (BREAK).
Line
18
prints a prompt and allows you to enter values for the principal P and
the rate R.
Line 38 prints a prompt and allows you to enter values for the time T and the number
of periods K. Lines 10 and 30 could have been combined into one line if desired.
Line 68 prints out the message "TOTAL IS $" and the value of S, the total of
principal and interest at the end of T years.
Line
78
skips a line on the display after the output from line 60. This spaces the
output so that it doesn't run together vertically.
Line 88 transfers control back to line 10, where the program starts over again. This
allows you to input a variety of values for the variables without entering the RUN
command each time.
38

Advertisement

Table of Contents
loading

Table of Contents