' *** COM2_EX.BAS - COMMON statement programming example ***
' This program uses COMMON to accept values input in COM1_EX.BAS,
' then computes and prints their average.
'
DIM X(1 TO 50)
COMMON X(), N

PRINT
PRINT "Now executing file COM2_EX.BAS, reached through a CHAIN command"
IF N > 0 THEN
   Sum = 0
   FOR I = 1 TO N
      Sum = Sum + X(I)
   NEXT I
   PRINT "The average of the values is"; Sum / N
END IF

