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.
uses crt;
var n,t:integer;
begin
clrscr;
n:=0; t:=0;
while t<=100 do
begin
n:=n+1;
t:=t+n;
end;
writeln(n);
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.
*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 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.
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.
program whilefor;
var
s,i,n:integer;
begin
write(' nhap n : ');
readln(n);
s:=0;
for i:= 1 to n do
s:= s +i;
writeln(' tong khi dung vong lap for la : ',s);
s:=0;
i:=0;
while i<=n do
begin
i:=i+1;
s:=s+i;
end;
write(' tong khi dung vong lap while la : ',s);
readln;
end.
Program CT_Tinh_Tong;
Uses Crt;
Var n,i:integer;
S;longint;
Begin
CLRSCR;
Write ('n=');readln (n);
S:=0;
For i:=1 to n do S:=S+i;
Write ('S=',S);
Readln;
End.
Program HOC24;
var i,n: integer;
S: longint;
begin
write('Nhap N: '); readln(n);
i:=1; s:=0;
while i<=n do
begin
s:=s+i;
i:=i+2;
end;
write('S=',S);
readln
end.
program tinh_tong_S;
var
n, i, S: integer;
begin
write('Nhap n: ');
readln(n);
S := 0;
i := 1;
while i <= n do
begin
S := S + i;
i := i + 2;
end;
writeln('Tong S la: ', S);
readln;
end.
program Tinh_S;
var i,n:integer;
S:real;
begin
writeln('Nhap so n=') ; readln(n);
i:=1 ; S:=0;
while i<=n do
begin
S:=S+1/n*(n+1); i:=i+1;
end;
writeln('Tong S=',S);
readln
end.
program tinhtong;
uses crt;
var n,i,s:integer;
begin
clrscr;
write('nhap n=');
readln(n);
while (n>100) do
begin
write('nhap lai n<100:');
readln(n);
end;
s:=0;
for i:=1 to n do s:=s+i;
write('tong vua tinh la:',s:3);
readln;
end.
Người mới vô có gì sai sót mong bỏ qua :))