    PROGRAM nag_normal_dist_ex02

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

      ! .. Use Statements ..
      USE nag_normal_dist, ONLY : nag_bivar_normal_prob
      USE nag_examples_io, ONLY : nag_std_out, nag_std_in
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      REAL (wp) :: prob, rho, x, y
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program results for nag_normal_dist_ex02'

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

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '         X          Y           RHO      PROB'
      WRITE (nag_std_out,*)

      DO
        READ (nag_std_in,*,end=20) x, y, rho

        prob = nag_bivar_normal_prob(x,y,rho)

        WRITE (nag_std_out,'(1X,3F12.3,F10.4)') x, y, rho, prob
      END DO
20    CONTINUE

    END PROGRAM nag_normal_dist_ex02
