Answer the question
In order to leave comments, you need to log in
Can you explain how this code (recursive formula) works?
Number 4.
Here is the code:
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
x, eps, R, S, St, Ea, Eo: real;
n, k: integer;
begin
writeln('Ведите x, eps, k');
readln(x, eps, k);
writeln;
n:=0;
S:=1+(x*x)/2;
R:=1*(x*x)/2*2;
St:=sqrt(1+x);
while abs(R)>=eps do
begin
n:=n+1;
R:=(-1)*R*x*(2*n-1)/(2*n+2);
S:=S+R;
end;
Ea:=(Abs(sqrt(1+x)-S));
Eo:=(Abs((sqrt(1+x)-S)/sqrt(1+x)));
writeln('S=', S:k+3:k);
writeln('R=', R:k+3:k);
writeln('n=', n);
writeln('St=', St:k+3:k);
writeln('Ea=', Ea:k+3:k);
writeln('Eo=', Eo:k+3:k,'%');
readln;
{ TODO -oUser -cConsole Main : Insert code here }
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question