Example description
!   D01UBF Example Program Text
!   Mark 26.1 Release. NAG Copyright 2017.

    Module d01ubfe_mod
!     D01UBF Example Program Module:
!            Parameters and User-defined Routines

!     .. Use Statements ..
      Use nag_library, Only: nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Accessibility Statements ..
      Private
      Public                           :: fun
!     .. Parameters ..
      Integer, Parameter, Public       :: nout = 6
    Contains
      Subroutine fun(x,f,n,iuser,ruser,ifail)

!       .. Scalar Arguments ..
        Integer, Intent (Inout)        :: ifail
        Integer, Intent (In)           :: n
!       .. Array Arguments ..
        Real (Kind=nag_wp), Intent (Out) :: f(n)
        Real (Kind=nag_wp), Intent (Inout) :: ruser(*)
        Real (Kind=nag_wp), Intent (In) :: x(n)
        Integer, Intent (Inout)        :: iuser(*)
!       .. Executable Statements ..
        f = x
      End Subroutine fun

    End Module d01ubfe_mod

    Program d01ubfe

!     .. Use Statements ..
      Use d01ubfe_mod, Only: fun, nout
      Use nag_library, Only: d01ubf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: ans
      Integer                          :: ifail, n
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: ruser(1)
      Integer                          :: iuser(1)
!     .. Executable Statements ..
      Write (nout,*) 'D01UBF Example Program Results'
      n = 10
      ifail = 0
      Call d01ubf(fun,n,ans,iuser,ruser,ifail)
      Write (nout,*)
      Write (nout,99999) 'Approximation to the integral = ', ans

99999 Format (1X,A,F12.5)
    End Program d01ubfe