VTech Precomputer Power Pad Plus Games User Manual


 
35
LET’S DO SOME ARITHMETIC
In the previous section you learned to program the sum of three numbers using the BASIC
program. Numbers like 1, 3, 27, 14.3, etc., are called CONSTANTS, numbers that do not
change value. 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 very 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?
Type this:
10 PRINT 6*2.204 press ENTER
RUN
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?
Type this:
10 PRINT 6/2.204 press ENTER
RUN
You can also 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 dollar
and throw the dice 10 times; each time you double your money. How much have you
won?
Type this:
10 PRINT 2^10 press ENTER
RUN
When you use all the operations together, it can get a bit complicated. After a winning
baseball game, your 7 person team is awarded 3 cans of pop for the game plus another
11 cans because you finished first in the league. How many cans does each player get?