var i,n: integer;
s:real;
begin
write(‘Nhập n: ‘); readln(n);
i:=1;
repeat
s:=s+1/i;
i:=i+1;
until i=n;
write(‘s =‘, s:0:4);
readln
end.
diepbich 016/08/2021 at 03:53Reply
Program Hotboy ;
Uses crt;
Var n,i,s : real;
Begin
Writeln(‘nhap n’); readln(n);
Repeat
S:=S+ 1/i;
I:=i+1 ;
Until n=i;
Writeln(‘S=’,S);
Readln
End.
uses crt;
var i,n:integer;
s:real;
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do s:=s+1/i;
writeln(s:4:2);
readln;
end.