      PROGRAM xmidpnt
C     driver for routine midpnt
      INTEGER NMAX
      PARAMETER(NMAX=10)
      INTEGER i
      REAL a,b,fint2,func2,s,s1,s2,binf
      EXTERNAL fint2,func2
      a=0.0
      b=1.0
      binf=2e30
      write(*,*) 'Integral of FUNC2 computed with MIDINF'
      do 11 i=1,NMAX
        call midpnt(func2,a,b,s1,i)
c        write(*,'(1x,i6,f24.6)') i,s1
11    continue

      do i=1,NMAX
        call midinf(func2,b,binf,s2,i)
c        write(*,'(1x,i6,f24.6)') i,s2
      End do
      print *, "Int [0,1] ",s1,"  Int[0,Inf]",s2
      s=s1+s2
      print *, "Tocan rezultat je 1"
      write(*,'(1x,f24.6)') s
      END

      REAL FUNCTION func2(x)
      REAL x
      func2=exp(-x)
      END

