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.
Var i , n : integer;
S: real;
Begin
write (' n ='); read (n);
S:= 0
For i:= 1 to n do S:= S+ 1/i;
Write (S);
Readln;
End.
program bai1;
var s,n,i:longint;
begin
write('N= ');readln(n);
s:=0;
for i:=1 to n do s:=s+1/i;
write('s= ',s);
readln
end.
Var i , n : Integer;
S : real;
Begin
write (' n = ') ; read (n);
S:=0
For i:=1 to n do S:= S + 1/i;
Writeln ( S );
Readln;
End.
program bai1;
var i,n,s:longint;
begin
write('N= ');
readln(n);
s:=1;
for i:=2 to n do s:=s+1/i;
write('s= ',s);
readln
end.
Bài 1:
uses crt;
var a:real;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
a:=0;
i:=1;
while i<=n do
begin
a:=a+1/i;
i:=i+1;
end;
writeln(a:4:2);
readln;
end.
a: uses crt;
var i,n:integer;
s:real;
begin
clrscr;
s:=0;
for i:=1 to 100 do s:=s+1/i;
writeln(s:4:2);
readln;
end.
b:
uses crt;
var i,n:integer;
s:real;
begin
clrscr;
s:=0;
i:=0;
while i<=100 do
begin
inc(i);
s:=s+1/i;
end;
writeln(s:4: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.
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.
uses crt;
var i,t:integer;
begin
clrscr;
t:=0;
for i:=1 to 100 do t:=t+i;
writeln(t);
readln;
end.
uses crt;
var i,t:integer;
begin
clrscr;
t:=0;
for i:=1 to 100 do t:=t+i;
writeln(t);
readln;
end.
progarm Tinh_Tong;
uses crt;
var n,i:integer;
S:real;
begin;
clrscr;
writeln('nhap n = ');
readln(n);
s:=0;
for i :=1 to n do S :=S + 1/i;
writeln('tong S = ',S:5:2);
readln
end.
program bai1;
var t,i,n:longint;
begin
{repeat
write('N= ');
readln(n);
unntil n>0}sử dụng repeat until cũng đc
t:=1;i:=2;
while i<=n do
begin
t:=t+1/i;
i:=i+1;
end;
write('T= ',t);
readln
end.