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

NAG FL Interface Introduction
Example description
    Program g07aafe

!     G07AAF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g07aaf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: clevel, phat, pl, pu
      Integer                          :: ifail, k, n
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'G07AAF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) ' Probability    Confidence Interval '
      Write (nout,*)

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

!       Calculate probability
        phat = real(k,kind=nag_wp)/real(n,kind=nag_wp)

!       Compute probability
        ifail = 0
        Call g07aaf(n,k,clevel,pl,pu,ifail)

!       Display results
        Write (nout,99999) phat, '(', pl, ' ,', pu, ' )'
      End Do d_lp

99999 Format (1X,F10.4,6X,A,F7.4,A,F7.4,A)
    End Program g07aafe