viết chương trình tính tổng 1+2+3+…+120 với câu lệnh while do 13/08/2021 Bởi Arya viết chương trình tính tổng 1+2+3+…+120 với câu lệnh while do
uses crt;var s,i:integer;begin clrscr; while i<=120 do begin s:=s+i; inc(i); end; write(‘Tong la: ‘,s); readlnend. Bình luận
program oken;uses crt;var i,s: integer;begin clrscr; i:=1; while i<=120 do begin s:=s+i; i:=i+1; end; writeln(‘Tong cac so tu 1->120: ‘,s); readln;end. Bình luận
uses crt;
var s,i:integer;
begin
clrscr;
while i<=120 do
begin
s:=s+i;
inc(i);
end;
write(‘Tong la: ‘,s);
readln
end.
program oken;
uses crt;
var i,s: integer;
begin
clrscr;
i:=1;
while i<=120 do
begin
s:=s+i;
i:=i+1;
end;
writeln(‘Tong cac so tu 1->120: ‘,s);
readln;
end.