function [y] = f(x)
   y=x^3-3*x^2+2;
endfunction;
a=input("a = ");
b=input("b = ");
if a>b then
    c=b ; b=a ; a=c;
end
if f((a+b)/2)*f(a) <=0 then
    while b-a >10^(-5)
        if f((a+b)/2)*f(a) <=0 then
            b=(a+b)/2;
        else 
            a=(a+b)/2;
        end
    end
end
disp(a);disp(b)