Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
program TinhTongWhileDo;
var
n, i: integer;
S: real;
begin
write('Nhap so n: ');
readln(n);
S := 0;
i := 1;
while i <= 2*n do
begin
S := S + 1/i;
i := i + 1;
end;
writeln('Tong S=1/1+1/2+1/3+1/4+...+1/2n la: ', S:0:2);
readln;
end.
b)
uses crt;
var i,n:integer;
t:real;
begin
clrscr;
write('Nhap n='); readln(n);
i:=1;
t:=0;
while i<=n do
begin
t:=t+1/(i*(i+3));
i:=i+1;
end;
writeln(t:4:2);
readln;
end.
*B=2+4+6+...+2020
uses crt;
var b:real;
i:integer;
begin
clrscr;
b:=0;
i:=0;
while i<=2020 do
begin
i:=i+2;
b:=b+i;
end;
writeln(b:0:0);
readln;
end.
*C=1/3+1/6+1/9+...+1/3n
uses crt;
var c:real;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
c:=0;
i:=1;
while i<=n do
begin
c:=c+1/(3*i);
i:=i+1;
end;
writeln(c:4:2);
readln;
end.
program tinhtong;
var n,i : integer;
S : real;
begin
write('Nhap n: ');
readln(n);
i:=1;
S:=0;
while i<=n do
begin
S:=S+1/i;
i:=i+1;
end;
writeln('Tong S= ',S);
readln;
end.
program tinh_tong_S;
var
n, i: integer;
S: real;
begin
write('Nhap n: ');
readln(n);
S := 0;
i := 1;
while i <= n do
begin
S := S + 1 / i;
i := i + 1;
end;
writeln('Tong S la: ', S:0:2);
readln;
end.
*while..do
Program HOC24;
var i,n: integer;
s: real;
begin
write('Nhap n: '); readln(n);
i:=1;
while i<=n do
begin
s:=s+1/sqr(i);
i:=i+1;
end;
write('S= ',s:6:2);
readln
end.
program tong_for_to_do;
uses crt;
var i,n:integer;
t:real;
begin
clrscr;
write('nhap n:');readln(n);
t:=0;
for i:=1 to n do
if i mod 3=0 then t:=t+1/i;
writeln('tong la: ',t);
readln;
end.
program tong_while_do;
uses crt;
var i,n:integer;
t:real;
begin
clrscr;
write('nhap n:');readln(n);
t:=0;i:=3;
while i<=3*n do
begin
t:=t+1/i;
i:=i+3;
end;
writeln('tong la: ',t);
readln;
end.
var i,n,s:integer;
begin
write('nhap n = ');readln(n);
i:=1;
while i<=n do
begin
s:=s+i;
i:=i+1;
end;
write('Tong la ',s);
readln;
end.
uses crt;
var c,d:real;
i,n,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
i:=1;
c:=0;
while i<=n do
begin
i:=i+1;
c:=c+1/i;
end;
writeln('C=',c:4:2);
d:=0;
j:=1;
while j<=49 do
begin
d:=d+1/(j*(j+1));
inc(j);
end;
writeln('D=',d:4:2);
readln;
end.