program drvbisect integer limit, maxits, nobrac, noofit, solved, status real f, lastx0, lastx1, resid, root, tol, x0, x1 parameter (tol=1e-6, maxits=25) parameter (solved=0, limit=1, nobrac=2) external bisect, f print *, 'Give two initial values that bracket the root' read *, x0, x1 call bisect(f, inx0, inx1, tol, maxits, + status, root, resid, noofit, lastx0, lastx1) if (status.eq.solved) write(*,2000) root, resid, noofit if (status.eq.limit) write(*,2010) maxits, lastx0, lastx1 if (status.eq.nobrac) write(*,2020) x0, x1 2000 format(1x,'Root = ', f10.6,' at which f(x) = ',f8.6 + /1x,'Converged after ', i2,' iterations') 2010 format(1x,'Not converged after ',i2,' iterations' + /1x,'Current interval is ',f10.6,' to ', f10.6) 2020 format(1x,'Initial approximations, ',f10.6,' and ',f10.6, + ', are on the same side of the root') end