uses crt; var n,i:longint; s:extended; begin clrscr; write(‘Nhap n (n<=100): ‘); readln(n); while (n<1) or (n>100) do begin writeln(‘NHAP LAI!’); write(‘Nhap n (n<=100): ‘); readln(n); end; for i:=1 to 2*n+1 do if i mod 2=1 then s:=s+1/i; writeln(‘S=’,s:0:2); readln; end.
Program tinh_tong;
Uses crt;
Var i,n: byte;
S: real;
Begin
Write (‘Nhap n=’);
Readln (n);
S:=1;
For i:= 1 to n do
S:= S+ 1/(2*i+1);
Writeln (‘Tong S la:’, S:7:2);
Readln
End.
uses crt;
var n,i:longint;
s:extended;
begin
clrscr;
write(‘Nhap n (n<=100): ‘); readln(n);
while (n<1) or (n>100) do
begin
writeln(‘NHAP LAI!’);
write(‘Nhap n (n<=100): ‘); readln(n);
end;
for i:=1 to 2*n+1 do if i mod 2=1 then s:=s+1/i;
writeln(‘S=’,s:0:2);
readln;
end.