    PROGRAM nag_quad_1d_ex05

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

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_quad_1d, ONLY : nag_quad_1d_data
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, n
      REAL (wp) :: result
      ! .. Local Arrays ..
      REAL (wp), ALLOCATABLE :: x(:), y(:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_quad_1d_ex05'

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

      ALLOCATE (x(n),y(n))         ! Allocate storage

      READ (nag_std_in,*) (x(i),y(i),i=1,n)

      CALL nag_quad_1d_data(x,y,result)

      WRITE (nag_std_out,'(/,1X,A,F9.5)') &
       'result - approximation to the integral =', result

      DEALLOCATE (x,y)             ! Deallocate storage

    END PROGRAM nag_quad_1d_ex05
