PROGRAM Processing_Failure_Times_1
!-----------------------------------------------------------------------
! Program to read a list of failure times, calculate the mean time to
! failure, and then print a list of failure times that are greater
! than the mean.  Identifiers used are:
!     FailureTime          : one-dimensional array of failure times
!     NumTimes             : size of the array (constant)
!     I                    : subscript
!     Sum                  : sum of failure times
!     Mean_Time_to_Failure : mean of the failure times
!
! Input:  A list of NumTimes failure times
! Output: Mean_Time_to_Failure and a list of failure times greater
!         than Mean_Time_to_Failure
!-----------------------------------------------------------------------

  IMPLICIT NONE
  INTEGER, Parameter :: NumTimes = 50
  REAL, DIMENSION(NumTimes) :: FailureTime
  INTEGER :: I
  REAL :: Sum, Mean_Time_to_Failure

  ! Read the failure times and store them in array FailureTime

  PRINT *, "Enter the ", NumTimes, "failure times, as many per line &
          &as desired"
  READ *, FailureTime

  ! Calculate the mean time to failure

  Sum = 0.0
  DO I = 1, NumTimes
     Sum = Sum + FailureTime(I)
  END DO
  Mean_Time_to_Failure = Sum / REAL(NumTimes)
  PRINT '(/ 1X, "Mean time to failure =", F6.1)', Mean_Time_to_Failure

  ! Print list of failure times greater than the mean

  PRINT *
  PRINT *,  "List of failure times greater than the mean:"
  DO I = 1, NumTimes
     IF (FailureTime(I) > Mean_Time_to_Failure) &
        PRINT '(1X, F9.1)', FailureTime(I)
  END DO

END PROGRAM Processing_Failure_Times_1
