        program dosecant
        implicit none
        external f
        double precision a,b,f,tol
        integer itmax,flag
        print*,'enter a and b'
        read*,a,b
        print*,'enter tolerance'
        read*,tol
        itmax = 20
        call secant(a,b,f,tol,itmax,flag)
        if (flag .eq. 0) then
          print*,'tolerance met, root is ', b
        else
          print*,'tolerance not achieved, last iterate is',b
        endif
        end
