Multiplication And Division; Exponentiation; Order Of Operations - Commodore 128 System Manual

Table of Contents

Advertisement

Multiplication and Division

Find the asterisk key (*) on the right side of your keyboard. This
is the symbol that the Commodore 128 uses for multiplication.
The slash ( /) key, located next to the right SHIFT key, is used for
division.
Try these examples:
PRINT 5*3 RETURN
PRINT 100/2 RETURN

Exponentiation

Exponentiation means to raise a number to a power. The up
arrow key (t), located next to the asterisk on your keyboard, is
used for exponentiation. If you want to raise a number to a power,
use the PRINT command, followed by the number, the up arrow
and the power, in that order. For example, to find out what 3
squared is, type:
3
2
p r i n t
T

Order of Operations

You have seen how you can combine addition and subtraction in
the same PRINT command. If you combine multiplication or
division with addition or subtraction operations, you may not get
the result you expect. For example, type:
PRINT 4 + 6 /2
If you assumed you were dividing 10 by 2, you were probably
surprised when the computer responded with the answer 7. The
reason you got this answer is that multiplication and division
operations are performed by the computer before addition or
subtraction. Multiplication and division are said to take
precedence over addition and subtraction. It doesn't matter in
what order you type the operation, ln computing, the order in
which mathematical operations are performed is known as the
order of operations.
Exponentiation, or raising a number to a power, takes
precedence over the other four mathematical operations. For
example, if you type:
n rm m i
RETURN
3-21

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents