Line 18
|
initializes the counting process. I = 1 indicates that the area of the first parallelogram is about to be calculated.
|
Line 50
|
I = I+ 1 instructs the computer to advance to the next parallelogram.
|
Line 60
|
reroutes the computer back to line 20 to find the area of the new parallelogram provided the number of the parallelogram has not exceeded 15. As soon as I >15 the program will stop.
|
Line 70
|
Although more than 15 sets of values for B
|
71
|
and H have been given, only the first 15 sets
|
72
|
of data will be used.
|
Program
6
|
introduces the concept of a dimension statement and subscripted variables.
|
|
4 REM AREA OF ANY NUMBER OF PARALLELOGRAMS
|
|
5 PRINT “BASE”, “ALTITUDE”, “AREA”
|
|
6 PRINT
|
|
10 DIM B(100), H(100), A(100)
|
|
20 READ N
|
|
30 FOR I = 1 TO N
|
|
40 READ B(I), H(I)
|
|
50 LET A(I) = B(I)* H(I)
|
|
60 PRINT B(I), H(I), A(I)
|
|
70 NEXT I
|
|
80 DATA 14,23,34,46,57,65,78,86,98,76,56,74,88
|
|
81 DATA 90,12,34,56,78,86,122,204,368,456,765
|
|
82 DATA 215,332,445,895,766,34,68,88,66
|
|
90 END
|