    Program g01eyfe

!     G01EYF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: g01eyf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: d, prob
      Integer                          :: ifail, n
!     .. Executable Statements ..
      Write (nout,*) 'G01EYF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '    D       N    One-sided probability'
      Write (nout,*)

d_lp: Do
        Read (nin,*,Iostat=ifail) n, d
        If (ifail/=0) Then
          Exit d_lp
        End If

!       Calculate probability
        ifail = 0
        prob = g01eyf(n,d,ifail)

!       Display results
        Write (nout,99999) d, n, prob
      End Do d_lp

99999 Format (1X,F7.4,2X,I4,10X,F7.4)
    End Program g01eyfe
