      PROGRAM FAIL3
************************************************************************
* Program to read a list of failure times, count them, and find the    *
* mean time to failure.  Values are read until the user indicates that *
* there is no more data.  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                              *
*     RESPON  :  user response                                         *
*                                                                      *
* 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, RESPON
      REAL FAILTM, SUM, MEAN
 
* Initialize SUM and COUNT
 
      SUM = 0
      COUNT = 0
 
* Read fail times, count and sum them until there are no more
 
10 	CONTINUE
          PRINT *, 'ENTER FAIL TIME'
          READ *, FAILTM
          COUNT = COUNT + 1
          SUM = SUM + FAILTM
          PRINT *, 'MORE (0 = NO, 1 = YES)'
          READ *, RESPON
      IF (RESPON .NE. 0) GO TO 10
 
* 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

