      program prog03
      implicit real*8 (a-h,o-z)
      write(*,*) 'a, b = ?'
      read(*,*)   a, b
      write(*,*) 'a = ',a,' b = ',b
      exa=2*(sqrt(b)-sqrt(a))
c
      do n=10,100,10
         call chuten(a,b,n,sum)
         dx=(b-a)/n
         err=abs(sum-exa)
         write( *,800) n, dx, sum, exa, err, err/dx/dx
         write(16,800) n, dx, sum, exa, err, err/dx/dx
      enddo
c234567
 800  format(1x,i3,5(1x,f10.7))
c
      end
c **********************************************************************
      subroutine chuten(a,b,n,sum)
c **********************************************************************
      implicit real*8 (a-h,o-z)
c
      sum = 0.0d0
      dx = (b - a)/n
      do i = 1, n
         x = a + (i - 0.5d0)*dx
         sum = sum + f(x)
      end do
      sum = sum*dx
c
      end
c **********************************************************************
      function f(x)
c **********************************************************************
      implicit real*8 (a-h,o-z)
      f = 1.0d0/sqrt(x)
      end
