Program g01emfe

!     G01EMF Example Program Text

!     Mark 26 Release. NAG Copyright 2016.

!     .. Use Statements ..
      Use nag_library, Only: g01emf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: q, v, valp
      Integer                          :: ifail, ir
!     .. Executable Statements ..
      Write (nout,*) 'G01EMF Example Program Results '
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '  Q       V    IR    Prob     '
      Write (nout,*)

d_lp: Do
        Read (nin,*,Iostat=ifail) q, v, ir
        If (ifail/=0) Then
          Exit d_lp
        End If

!       Calculate probability
        ifail = 0
        valp = g01emf(q,v,ir,ifail)

!       Display data
        Write (nout,99999) q, v, ir, valp
      End Do d_lp

99999 Format (1X,F7.4,2X,F4.1,1X,I3,1X,F10.4)
    End Program g01emfe