Real function Trapez(ff)
use work
real x, ffx(0:1)

Trapez =0.  !(ff(a)+ff(b))/2.
x0 =a

do i =0,n-1     !0,n-1,1
    do ii=0,1
    x =x0 +ii*h
    ffx(ii) =ff(x)
    enddo
Trapez =Trapez +ffx(0) +ffx(1)
x0 =x
enddo

Trapez =Trapez*h/2.

END
