1)
var x,xn,s:real; n,i,z:integer;
begin
write('x = ');
readln(x);
n:=20;
xn:=x;
s:=x;
z:=1;
for i:=1 to n do
begin
xn:=xn*x*x;
z:=-z;
s:=s+z*(i+1)*xn/(2*i+1);
end;
writeln('s = ',s);
end.
2)
var x,xn,s:real; n,i,z:integer;
begin
write('x = ');
readln(x);
n:=20;
xn:=x;
s:=x;
z:=1;
i:=0;
while i begin
i:=i+1;
xn:=xn*x*x;
z:=-z;
s:=s+z*(i+1)*xn/(2*i+1);
end;
writeln('s = ',s);
end.
3)
var x,xn,s:real; n,i,z:integer;
begin
write('x = ');
readln(x);
n:=20;
xn:=x;
s:=x;
z:=1;
i:=0;
repeat
i:=i+1;
xn:=xn*x*x;
z:=-z;
s:=s+z*(i+1)*xn/(2*i+1);
until i>=n;
writeln('s = ',s);
end.
Пример:
x = 1.5
s = 5.8792000810381370E+006