FORTRAN Average Program
C THIS PROGRAM READS INTEGERS INTO AN ARRAY, STORING
C THE ABSOLUTE VALUES, THEN COMPUTES AND PRINTS THE
C AVERAGE.
DIMENSION DTA(900)
C READ THE NUMBER OF INPUT VALUES
READ 10, N
10 FORMAT(I3)
C READ THAT MANY NUMBERS, STORING ABSOLUTE VALUES
DO 20 I = 1, N
READ 30, DTA(I)
30 FORMAT(F10.6)
IF(DTA(I)) 25,20,20
25 DTA(I) = -DTA(I)
20 CONTINUE
C COMPUTE THE SUM OF THE NUMBERS
SUM = 0.0
DO 40 I=1, N
SUM = SUM + DTA(I)
40 CONTINUE
C COMPUTE AND PRINT THE AVERAGE
AVG = SUM/FLOAT(N)
PRINT 50, AVG
50 FORMAT(1H ,F10.6)
STOP
END