var k,i,n:integer; s1,s:real;begink:=0;n:=0;s:=0;s1:=1; while s1>0.002 do begin s:=s+s1; s1:=1/(n+(n+1)); k:=k+1; n:=n+1; end; writeln(s-1:5:5,' ',k-1);end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var k,i,n:integer;
s1,s:real;
begin
k:=0;
n:=0;
s:=0;
s1:=1;
while s1>0.002 do
begin
s:=s+s1;
s1:=1/(n+(n+1));
k:=k+1;
n:=n+1;
end;
writeln(s-1:5:5,' ',k-1);
end.