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 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.
a)
uses crt;
var s,i,n:integer;
begin
clrscr;
write('nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+i;
writeln(s);
readln;
end.
b)
uses crt;
var s,i,n:integer;
begin
clrscr;
write('nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+i;
inc(i);
end;
writeln(s);
readln;
end.
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+i;
inc(i);
end;
writeln(s);
readln;
end.
uses crt;
var s:real;
i,n:integer;
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do
s:=s+(n*(n+1))/((n+2)*(n+3));
writeln(s:4:2);
readln;
end.
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.