ПАСКАЛЬ, 10 КЛАСС, ОЧЕНЬ НАДО!! Заполните массив случайными числами в интервале [100, 999] и переставьте их по возрастанию старшей цифры
Answers & Comments
sergey201979
Var a: array[1..10] of integer; i, j, temp: integer; begin randomize; for i := 1 to 10 do begin a[i] := random(100,999); write(a[i]:3); end; writeln; for i := 1 to 10 - 1 do for j := i + 1 to 10 do if a[i] > a[j] then begin temp := a[i]; a[i] := a[j]; a[j] := temp; end; for i := 1 to 10 do write(a[i]:3); end.
Answers & Comments
a: array[1..10] of integer;
i, j, temp: integer;
begin
randomize;
for i := 1 to 10 do
begin
a[i] := random(100,999);
write(a[i]:3);
end;
writeln;
for i := 1 to 10 - 1 do
for j := i + 1 to 10 do
if a[i] > a[j] then
begin
temp := a[i];
a[i] := a[j];
a[j] := temp;
end;
for i := 1 to 10 do
write(a[i]:3);
end.