EasyManua.ls Logo

Radio Shack TRS-80 Model 100 - Page 42

Radio Shack TRS-80 Model 100
210 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Experiment
#4
Another Way to INPUT
The
INPUT.
statement
is
usually preceded by a prompt message
to
remind you what
value
to
enter.
An
optional form
of
the INPUT statement allows the prompt
to
be
printed without using a separate PRINT statement.
Delete line
15
(by entering just the line number
15)
and retype line
10
as
follows:
10
INPUT
"PRINCIPAL";
P
This single line is equivalent
to
the previous lines
10
and
15.
The word PRINCIPAL
will be printed immediately followed by a question mark. Then the Computer will
wait for you to enter the value for P. The ending quotation mark must be followed
by
a semicolon, a comma cannot be used.
List the program.
It
should read:
10
INPUT
"PRINCIPAL";
P
20
R =
12
30
T
;;;
5
40
K = 4
50
S = P *
(1
+ R /
K)~(T
*
K)
60
PRINT
"TOTAL
IS
$";
S
Execute the program. The following output occurs when you type 1000 for the
principal:
PRINCIPAL7
1000
TOTAL
IS
$
1806.1112346693
Ok
II
Run the program several times, entering different values for
the
principal.
Experiment
#5
Compound Interest with More
Keyboard Input
In this experiment, the compound interest program will be changed
so
that the rate,
as
well
as
the principal, can be input from the keyboard.
Delete line
20
by entering just the line number.
Retype line
10
as:
10
INPUT
"PRINCIPAL
t
RATE";
P t R
(ENTER)
36

Other manuals for Radio Shack TRS-80 Model 100

Related product manuals