NAG Library Manual, Mark 29.3
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program g01ezfe

!     G01EZF Example Program Text

!     Mark 29.3 Release. NAG Copyright 2023.

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

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

!     Display titles
      Write (nout,*) '    D      N1    N2    Two-sided probability'
      Write (nout,*)

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

!       Calculate probability
        ifail = -1
        prob = g01ezf(n1,n2,d,ifail)
        If (ifail/=0) Then
          If (ifail/=3) Then
            Exit d_lp
          End If
        End If

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

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