    PROGRAM f16dlfe

!      F16DLF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : f16dlf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       INTEGER                         :: i, incx, n, sumval
!      .. Local Arrays ..
       INTEGER, ALLOCATABLE            :: x(:)
!      .. Intrinsic Functions ..
       INTRINSIC                          abs
!      .. Executable Statements ..
       WRITE (nout,*) 'F16DLF Example Program Results'

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

       READ (nin,*) n, incx
       ALLOCATE (x(1+(n-1)*abs(incx)))

       READ (nin,*) (x(i),i=1,1+(n-1)*abs(incx),incx)

!      Sum the elements of X

       sumval = f16dlf(n,x,incx)

       WRITE (nout,*)
       WRITE (nout,99999) sumval

99999  FORMAT (1X,'Sum of elements of X is',I5)
    END PROGRAM f16dlfe
