    PROGRAM nag_normal_dist_ex04

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

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_out, nag_std_in
      USE nag_normal_dist, ONLY : nag_normal_deviate
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i
      REAL (wp) :: dev, p
      CHARACTER (1) :: tail
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program results for nag_normal_dist_ex04'

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

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) ' Tail         P           Deviate'
      WRITE (nag_std_out,*)

      DO i = 1, 4
        READ (nag_std_in,*) tail, p

        dev = nag_normal_deviate(tail,p)

        WRITE (nag_std_out,'(3X,A1,F14.3,F15.4)') tail, p, dev
      END DO

    END PROGRAM nag_normal_dist_ex04
