    PROGRAM nag_f_dist_ex02

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

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_out, nag_std_in
      USE nag_f_dist, ONLY : nag_f_deviate
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      REAL (wp) :: dev, df1, df2, p
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_f_dist_ex02'

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

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '     P      DF1     DF2      F'
      WRITE (nag_std_out,*)

      DO
        READ (nag_std_in,*,end=20) p, df1, df2

        dev = nag_f_deviate(p,df1,df2)

        WRITE (nag_std_out,'(1X,4F8.3)') p, df1, df2, dev
      END DO
20    CONTINUE

    END PROGRAM nag_f_dist_ex02
