im programing student our master wanna me make this program with 0.1 accuracy i use "writeln(h:nr:nl)" that was wrong
this is original program 2 cal sum of 1¹-(2³/3!)+(2⁵/5!)-(2⁷/7!)+(2⁹/9!)…+-(2ⁿ...
program p1;
var n,i,sign: integer; h,p,fac: real;
begin
h:=1; p:=2; sign:=-1; fac:=1;
readln(n);
for i:=2 to n do
begin
fac:=fac*i;
p:=p*2;
if (i mod 2)<>0 then
begin
h:=h+sign*p/fac;
sign:=-sign;
end;
i:=i+1;
end;
writeln(h);
end.
please help me