Program g01jdfe

!     G01JDF Example Program Text

!     Mark 26.1 Release. NAG Copyright 2017.

!     .. Use Statements ..
      Use nag_library, Only: g01jdf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: c, d, prob
      Integer                          :: ifail, n
      Character (1)                    :: method
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: rlam(:), work(:)
!     .. Executable Statements ..
      Write (nout,*) 'G01JDF Example Program Results'
      Write (nout,*)

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

!     Read in the problem size
      Read (nin,*) n, method, d, c

      Allocate (rlam(n),work(n+1))

!     Read in data
      Read (nin,*) rlam(1:n)

!     Calculate probability
      ifail = 0
      Call g01jdf(method,n,rlam,d,c,prob,work,ifail)

!     Display results
      Write (nout,99999) ' Values of lambda ', rlam(1:n)
      Write (nout,99999) ' Value of D       ', d
      Write (nout,99999) ' value of C       ', c
      Write (nout,*)
      Write (nout,99998) ' Probability = ', prob

99999 Format (1X,A,10F6.2)
99998 Format (1X,A,F10.4)
    End Program g01jdfe