const
n = 10;
var
a:array[1..n] of integer;
i, j:integer;
begin
randomize;
writeln('Исходный массив:');
for i := 1 to n do
begin
a[i] := random(101);
write(a[i], ' ');
end;
for i := 1 to n - 1 do
for j := 1 to n - i do
if a[j] mod 10 > a[j + 1] mod 10 then
begin
a[j] := a[j] + a[j + 1];
a[j + 1] := a[j] - a[j + 1];
a[j] := a[j] - a[j + 1];
end;
writeln;
writeln('Результат:');
for i := 1 to n do
write(a[i], ' ');
writeln;
end.