Var s,f,e:real; k,z:integer; begin s:=1; z:=1; f:=1; e:=exp(1); writeln('1 /',e,' = ',1/e); for k:=1 to 30 do begin z:=-z; f:=f*k; s:=s+z/f; if k mod 10=0 then writeln('s = ',s,' s-1/e = ',s-1/e); end; end.
Пример: 1 / 2.718281828459045e+00 = 3.678794411714423e-01 s = 3.678794642857144e-01 s-1/e = 2.311427205192729e-08 s = 3.678794411714424e-01 s-1/e = 1.110223024625157e-16 s = 3.678794411714424e-01 s-1/e = 1.110223024625157e-16
Answers & Comments
Verified answer
Var s,f,e:real; k,z:integer;begin
s:=1;
z:=1; f:=1;
e:=exp(1);
writeln('1 /',e,' = ',1/e);
for k:=1 to 30 do
begin
z:=-z;
f:=f*k;
s:=s+z/f;
if k mod 10=0 then writeln('s = ',s,' s-1/e = ',s-1/e);
end;
end.
Пример:
1 / 2.718281828459045e+00 = 3.678794411714423e-01
s = 3.678794642857144e-01 s-1/e = 2.311427205192729e-08
s = 3.678794411714424e-01 s-1/e = 1.110223024625157e-16
s = 3.678794411714424e-01 s-1/e = 1.110223024625157e-16