BASIC4.WPS

BASIC LANGUAGE PROGRAMMING

USING VARIABLES IN SIMPLE PROGRAMS

 

The following is a simple program used to compute the

area of a rectangle of width 2 meters by 3 meters in length.

Please note that the assignment statement LET is optional.

CLS

LET L=3

LET W=2

LET AREA=L*W

PRINT "The Length of the rectangle is"

PRINT L

PRINT "The Width of the rectangle is"

PRINT W

PRINT " The Area of the rectangle is"

PRINT AREA

END

Enter the program and find the areas for the following

rectangles. NOTE**** you must change the L and W

in the program for each calculation.

1) L= 23.45 W= 14.29 A= __________

2) L= 45.65 W= 2.55 A=___________

3) L= 65.22 W= 23.67 A=___________

4) L= 89.23 W= 78.14 A=___________

 

THE INPUT STATEMENT

Take the program above and replace the first two LET statements with INPUT

statements and then run the program and find the area of the following rectangles.

Fill in the blanks.

5) L= 93.67 W= 78.34 A=_________

6) L= 63.68 W= 58.74 A=_________

7) L= 63.66 W= 48.14 A=_________

8) L= 73.77 W= 08.34 A=_________

9) L= 45.69 W= 38.34 A=_________

10) L= 33.67 W= 28.34 A=_________

11) L= 23.97 W= 18.34 A=_________

 

 

Design a program to halt for input and then calculate the

area of a triangle given the height and base. The program

is to print the value of the base, the height and the are to the computer screen.

Enter the program.

12) PRINT YOUR TRIANGLE AREA PROGRAM TO THE PRINTER

Find the area of the following triangles:

13) Base = 2 Height = 12 Area= _________

14) Base = 4 Height = 12 Area= _________

15) Base = 2.4 Height = 24.6 Area= _________

16) Base = 5 Height = 3.6 Area= _________

17) Base = 4 Height = 10.5 Area= _________

18) Base = 16.6 Height = 45.4 Area= _________

19) Base = 8 Height = 64 Area= _________

20) Base = 6.7 Height = 36 Area= _________

21) Base = 2.45 Height = 12 Area= _________

22) Base = 2 Height = 12 Area= _________

Copyright - Barry Boyle (bboyle@kawartha.net)