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

NAG FL Interface Introduction
Example description
    Program g01bjfe

!     G01BJF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: g01bjf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: p, peqk, pgtk, plek
      Integer                          :: ifail, k, n
!     .. Executable Statements ..
      Write (nout,*) 'G01BJF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '   N     P      K     PLEK      PGTK      PEQK'
      Write (nout,*)

!     Loop over all data
d_lp: Do
        Read (nin,*,Iostat=ifail) n, p, k
        If (ifail/=0) Then
!         All data processed
          Exit d_lp
        End If

!       Calculate probability
        ifail = 0
        Call g01bjf(n,p,k,plek,pgtk,peqk,ifail)

!       Display results
        Write (nout,99999) n, p, k, plek, pgtk, peqk
      End Do d_lp

99999 Format (1X,I4,F8.3,I5,3F10.5)
    End Program g01bjfe