Make your own free website on Tripod.com
program root;

var a,b,c: real;

    function raise (base: real; power: integer): real;

    var n: integer;
        num: real;

    begin

        num := 1;

        for n := 1 to power do
        begin
            num := num * base;
        end;

        raise := num;

    end;

    function f (x: real): real;

    begin

        f := raise(x,7) - (12 * raise(x,5)) + 1;

    end;

begin

    write ('A: '); readln (a);
    write ('B: '); readln (b);

    repeat

        c := a + (f(a) * ((b - a) / (f(a) - f(b))));

        write ('A: ',a:3:4);
        write (' B: ',b:3:4);
        write (' C: ',c:3:4);
        writeln (' f(c): ',f(c):3:4);

        if c = a then b:=c else a:=c;

        repeat until keypressed;

    until false;

end.