.



              

- 8


0.99999999... . , k -1, eps > 1.

, .

, :

Program Problem2a;

uses WinCrt;

var

u : longint;

x, eps : real;

{----------------------------------------------------------------------------------------}

{ - - }

Function t(eps : real) : integer;

var

k : integer;

begin

k := -1;

repeat

eps := eps*10;

k := k + 1

until eps > 1;

t := k

end;

{---------------------------------------------------------------------------------------}

Procedure Square_root(eps, u : real; var x : real);

begin

x := (u + 1)/2;

repeat

x := (1/2)*(x + u/x)

until abs(x*x - u) <= eps

end;

{---------------------------------------------------------------------------------------}

begin

write(' '); readln(u);

write(' '); readln(eps);

Square_root(eps, u, x);

writeln(' ', u, ' ', x:6:t(eps));

writeln(' ', eps:1:t(eps))

end.

Program Problem2b;

uses WinCrt;

var

u : longint;

x, eps : real;

{----------------------------------------------------------------------------------------}

{ - - }

Function t(eps : real) : integer;

var

k : integer;

begin

k := -1;