    PROGRAM g01alfe

!      G01ALF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01alf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       INTEGER                         :: ifail, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: res(5)
       REAL (KIND=nag_wp), ALLOCATABLE :: x(:)
       INTEGER, ALLOCATABLE            :: iwrk(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G01ALF Example Program Results'
       WRITE (nout,*)

!      Skip heading in data file
       READ (nin,*)

!      Read in the problem size
       READ (nin,*) n

       ALLOCATE (x(n),iwrk(n))

!      Read in data
       READ (nin,*) x(1:n)

!      Calculate summary statistics
       ifail = 0
       CALL g01alf(n,x,iwrk,res,ifail)

!      Display results
       WRITE (nout,99999) 'Maximum                   ', res(5)
       WRITE (nout,99999) 'Upper Hinge (75% quantile)', res(4)
       WRITE (nout,99999) 'Median      (50% quantile)', res(3)
       WRITE (nout,99999) 'Lower Hinge (25% quantile)', res(2)
       WRITE (nout,99999) 'Minimum                   ', res(1)

99999  FORMAT (1X,A,F16.4)
    END PROGRAM g01alfe
