Объяснение:
var
arr: array[0..9] of byte;
max, k, i, j: byte;
begin
j := 9;
randomize;
for i := 1 to 9 do begin
arr[i] := random(10);
write(arr[i]:4)
end;
writeln;
while j > 1 do begin
k := 1;
for i := 2 to j do
if arr[i] > arr[k] then
k := i;
max := arr[k];
arr[k] := arr[j];
arr[j] := max;
j := j - 1
for i := 1 to 9 do
write(arr[i]:4);
end.
Объяснение:
var
arr: array[0..9] of byte;
max, k, i, j: byte;
begin
j := 9;
randomize;
for i := 1 to 9 do begin
arr[i] := random(10);
write(arr[i]:4)
end;
writeln;
while j > 1 do begin
k := 1;
for i := 2 to j do
if arr[i] > arr[k] then
k := i;
max := arr[k];
arr[k] := arr[j];
arr[j] := max;
j := j - 1
end;
for i := 1 to 9 do
write(arr[i]:4);
writeln;
end.