  ! This software CALCAVER.F90 is part of the Visual Fortran kit.
  ! 
  ! This software is provided as an example that demonstrates a particular
  ! feature/function of the licensed product. The software is not intended to
  ! provide a complete solution to any application problem but rather is provided
  ! as a teaching mechanism.
  ! 
  ! Users may incorporate any part of this sample into their own source after 
  ! making appropriate changes to make it suitable for the intended application.

  ! This file contains the function declaration CALC_AVERAGE
  ! referenced by the main program.  It returns the average of 
  ! the array values.

  FUNCTION CALC_AVERAGE(D)
     REAL :: CALC_AVERAGE
     REAL, INTENT(IN) :: D(:)
     CALC_AVERAGE = SUM(D) / UBOUND(D, DIM = 1)
  END FUNCTION CALC_AVERAGE

