CT đây nhé!:
program tinhtong;
uses crt;
var i, n : integer; S : real;
begin
clrscr;
writeln('Nhap so thu n: '); readln(n);
S:=0; i:=1;
while i<=n do begin
S:=S+1/i; i:=i+1;
end;
writeln('Tong la: ',S:2:3);
readln
end.
program tinhtong;
uses crt;
var i, n : integer; S : real;
begin
clrscr;
writeln('Nhap so thu n: '); readln(n);
S:=0; i:=1;
while i<=n do begin
S:=S+1/i; i:=i+1;
end;
writeln('Tong la: ',S:2:3);
readln
end.