Another short cut. You can use the
"?"
symbol to stand for the word "PRINT".
When you are using BASIC as a calculator in "command mode", think of the
question mark as meaning "What is 12-4+ 7"? When you are using the question
mark as a "PRINT" command in a program, the computer will replace the "?" with
the word "PRINT" 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:
I
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 pound
parakeet weigh?
Try
this:
I
10 PRINT 6/2.204
You can raise a number to a power. 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 1
O
times; each time you
double your
money.
How much have you won?
Type:
10 PRINT 2"10
21
Need help?
Do you have a question about the PreComputer 2000 and is the answer not in the manual?