VTech Precomputer Power Pad Plus User Manual

Page 46

Advertising
background image

42

The A > 90 is a condition. The print “YOU ARE SMART” is the command given for the
true condition. In the above example, let’s give A the value 80. Would the message be
printed? No, it would not be printed because the condition is false (80 is less than 90).

Let’s try a program to compute the area of a rectangle.

Type:

NEW

10

INPUT “ENTER THE LENGTH”;L press ENTER

20

INPUT “ENTER WIDTH”;W

press ENTER

30

LET A=L*W

press ENTER

40

PRINT “THE AREA IS”;A

press ENTER

50

INPUT “ANOTHER? (Y/N)”;R$

press ENTER

60

IF R$=“Y” THEN 10

press ENTER

70

PRINT “THAT’S ALL FOLKS!”

press ENTER

80

END

RUN

This program uses the INPUT statement to get values for numeric variables and prints
a computed result. It then prompts for a string variable and makes the decision to begin
again if the value typed in is a Y.

Here’s another one.

Type:

NEW

10

INPUT “GIVE ME A NUMBER”;A

20

INPUT “AND ANOTHER”;B

30

PRINT “ADD, SUBTRACT, MULTIPLY OR DIVIDE”

40

PRINT “TYPE IN THE FIRST LETTER OF THE”

Advertising