var n,i,s:longint;
begin clrscr;
wroite('n=');readln(n);
s:=0;
for i:=1 to n do s:=s+2*i+1;
write(s);
readln;
end.
s=1+1/2+1/3+...+1/n
Giải: Program hotrotinhoc; var i,n: integer; s: real; begin write('n='); readln(n); s:=0; for i:=1 to n do s:=s+1/i; write(s:1:2); readln end.s=1+1/2+1/3+...+1/n
Giải:
Program hotrotinhoc;
var i,n: integer; s: real;
begin
write('n='); readln(n);
s:=0; for i:=1 to n do
s:=s+1/i;
write(s:1:2);
readln
end.