34
You can use
PRECOMPUTER PRESTIGE
TM
as a calculator in arithmetic statements like
the one above by not using a line number.
Just type:
PRINT 12-4+7
and press
Enter
The answer will appear on the display.
Another short cut is that you could use the
"?"
symbol to stand for the word "
".
When you are using BASIC as a calculator in "command mode", think of the question mark
as meaning "What is 12-4+7?" and when you are using the question mark as a "
"
command in a program, the computer will replace the "
?
" with the word "
" for you.
2. LET’S DO SOME ARITHMETIC
In the previous section you did a sum of three numbers. The numbers like 1, 3, 27, 14.3,
etc., are called
CONSTANTS
. The program added and subtracted the constants 12, 4 and
7. The order that you do addition is unimportant: 6+10 is the same as 10+6. In subtraction,
the order
is
important: 10-6 is not the same as 6-10. So the order that you write numbers
and do arithmetic operations is important. In BASIC, operations are from left to right.
The
*
symbol is used to represent multiplication. Like addition, the order of the numbers
is unimportant. Here’s an example. There are 2.204 pounds to a kilogram. How many
pounds does a 6 kilogram parakeet weigh?
Try this:
10 PRINT 6*2.204
The symbol
/
is used for division. Here, like in subtraction, the order of the numbers is
important since 15/3 is 5 and 3/15 is .2. How many kilograms does a 6 pounds parakeet
weigh?
Try this:
10 PRINT 6/2.204
You can raise a number to a power also. To do this you need the ^ sign. The expression
5^3 means 5
*
5
*
5 or 125; similarly, 3^5 means 3
*
3
*
3
*
3
*
3 or 243. There are fractional
powers; for example 2^.5 is the square root of 2 or 1.414.... Here’s an example: I bet
you 1 doubloon and throw the dice 10 times; each time you double your money. How
much have you won?
Summary of Contents for PreComputer Prestige
Page 1: ...COURSE BOOK...