Program HOC24;
var i,j,tong: integer;
t: longint;
a: array[1..2024] of longint;
begin
i:=0; t:=1; a[1]:=1; j:=1;
while i<>2023 do
begin
t:=t+i;
i:=i+1;
j:=j+1;
a[j]:=t;
end;
tong:=0;
for i:=1 to 15 do tong:=tong+a[i];
writeln('Tong 15 so hang dau la: ',tong);
write('So hang thu 2023 la: ',a[2023]);
readln
end.
Đúng 2
Bình luận (0)