    PROGRAM nag_discrete_dist_ex03

      ! Example Program Text for nag_discrete_dist
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_out, nag_std_in
      USE nag_discrete_dist, ONLY : nag_hypergeo_prob
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND, REAL
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: k, l, m, n
      REAL (wp) :: prob
      CHARACTER (1) :: tail
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) &
       'Example Program Results for nag_discrete_dist_ex03'

      READ (nag_std_in,*)          ! Skip heading in data file

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) &
       'tail      n       l      m      k     probability'
      WRITE (nag_std_out,*)

      DO

        READ (nag_std_in,*,end=20) tail, n, l, m, k

        prob = REAL(nag_hypergeo_prob(tail,n,l,m,k),kind=wp)

        WRITE (nag_std_out,'(2X,A1,3x,4I7,F15.4)') tail, n, l, m, k, prob

      END DO

20    CONTINUE

    END PROGRAM nag_discrete_dist_ex03
