EasyManua.ls Logo

Radio Shack TRS-80 Model 100

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...
Enter the command NEW
to
clear the previous program from memory. Then type the
following program:
10
P
=
5000
20
R
=
.12
30
T
=
5
40
K
=
4
50
S
=
P
*
( 1
+
R /
K)
~
(T
*
K)
80
PRINT
"TOTAL
IS
$"
;
S
After the program
is
entered, execute it by entering the RUN command
or
pressing
~.
The output frum this program will be:
TOTAL
IS
$
9030.5561733465
Ok
Even though the total
is
supposed to represent dollars and cents, the computer has
displayed the number with 14 significant digits, including 10
to
the right
of
the
decimal place (because this is the precision
of
numeric variables in Model 100
BASIC). You will see later how to display numbers in dollars and cents format.
The expression in line
50
P *
(l
+ R /
K)'(T
*
K)
uses addition, multiplication and exponentiation operators. The exponentiation operator
has the highest priority and will be performed before multiplication or division and
of
course before addition and subtraction. Because
of
this priority, it was necessary to
place parentheses around the exponent
T*K
Otherwise, the computer would have calculated
P *
(l
+ R / K) A T
and then multiplied this expression by K.
Experiment
#3
Compound Interest with
Keyboard Input
If
you wanted
to
run the compound interest program with different values for the
variables, you would have to retype the appropriate lines in the program. Obviously
that isn't very practical, specially
if
you just wanted to figure the interest for several
values.
34

Other manuals for Radio Shack TRS-80 Model 100

Related product manuals