PROGRAM g07aafe ! G07AAF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. 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 Functions .. 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