IBM 5110 Basic Introduction page 32

Table of Contents

Advertisement

28
You must use parentheses to separate consecutive operators, as in the
following examples:
Invalid
Valid
6+-4
6+(-4)
3*-1.5
3*(-1.5)
8--4
8-(-4)
Try to solve the fol/owing problems using your system. Remember to
press EXECUTE after entering each problem.
Answers
The order of arithmetic operators applies when variables are used
also. For example, evaluate the following expression, where A=12 and
B=4:
A times B plus (2 to the power of B)
The correct answer is 64.
A Note About Numbers
When you use numbers in BASIC, they can be:
• Integers (whole numbers) such as:
2, -76, 842, 10000000, or 999111
• Decimal numbers such as:
-1.5, 3.7772, 0.00081, or -457.25
• Numbers in exponential format such as:
6E7 (meaning 6x10
7 )
or 5.4E-3 (meaning 5.4x10-
3 )
o
()
o
28
You must use parentheses to separate consecutive operators, as in the
following examples:
Invalid
Valid
6+-4
6+(-4)
3*-1.5
3*(-1.5)
8--4
8-(-4)
Try to solve the fol/owing problems using your system. Remember to
press EXECUTE after entering each problem.
Answers
The order of arithmetic operators applies when variables are used
also. For example, evaluate the following expression, where A=12 and
B=4:
A times B plus (2 to the power of B)
The correct answer is 64.
A Note About Numbers
When you use numbers in BASIC, they can be:
• Integers (whole numbers) such as:
2, -76, 842, 10000000, or 999111
• Decimal numbers such as:
-1.5, 3.7772, 0.00081, or -457.25
• Numbers in exponential format such as:
6E7 (meaning 6x10
7 )
or 5.4E-3 (meaning 5.4x10-
3 )
o
()
o

Advertisement

Table of Contents
loading

Table of Contents