function y=f(x);y=x^3+x^2+x-2;
endfunction
a=input("a = ")
b=input("b = ")
n=input("n = ")
while b-a>10^(-n)
    m=(a+b)/2
    if f(a)*f(m)<0 then b=m
        else a=m
    end
end
afficher ("a = " + string(a)+" b = "+ string(b))