Цитата:
Сообщение от Mel_lissa
|
Запросто:
Код:
VAR
x,eps,S,A_old,A_new,p:Real;
n:word;
BEGIN
Write('x= ');
ReadLn(x);
Write('eps= ');
ReadLn(eps);
A_new:=1.0/(x+0.1);
S:=A_new;
p:=x;
n:=1;
Repeat
A_old:=A_new;
n:=n+1;
p:=p*x;
A_new:=1.0*n/(p+0.1*n);
S:=S+A_new;
Until ABS(A_old-A_new)<eps;
WriteLn('Sum= ',S);
WriteLn('n= ',n);
ReadLn;
END.