      PROGRAM FAIL1
************************************************************************
* Program to read a list of failure times, count them, and find the    *
* mean time to failure.  Values are read until an end-of-data flag     *
* (any value less than or equal to -999) is read.  Variables used are: *
*     FAILTM  :  the current fail time read                            *
*     COUNT   :  the number of fail time readings                      *
*     SUM     :  sum of fail times                                     *
*     MEAN    :  the mean time to failure                              *
*                                                                      *
* Input:  A list of fail times                                         *
* Output: Number of fail times read and their mean or a message        *
*         indicating that no failure times were entered                *
************************************************************************

      INTEGER COUNT
      REAL FAILTM, SUM, MEAN
 
* Initialize SUM and COUNT, and read 1-st fail time
 
      SUM = 0
      COUNT = 0
      PRINT *, 'ENTER FAIL TIME OF -999 OR LESS TO STOP'
      PRINT *, 'ENTER FAIL TIME'
      READ *, FAILTM
 
* While not end-of-data, count, sum, and read fail times
 
      DO WHILE (FAILTM .GT. -999)
          COUNT = COUNT + 1
          SUM = SUM + FAILTM
          PRINT *, 'ENTER FAIL TIME'
          READ *, FAILTM
      END DO
 
* Calculate and display mean time to failure
 
      IF (COUNT .GT. 0) THEN
          MEAN = SUM / COUNT
          PRINT *
          PRINT *, 'NUMBER OF FAIL TIME READINGS:', COUNT
          PRINT *, 'MEAN TIME TO FAILURE:', MEAN
      ELSE
          PRINT *, 'NO FAIL TIMES WERE ENTERED.'       
      END IF

      END

