var A: array [1..10] of integer; i, j, n, temp: integer;
begin randomize(); n := 10; for i := 1 to n do begin A[i] := random(100); write(A[i], ' '); end;
for j := 1 to n - 1 do begin for i := 1 to n - j do begin if a[i] mod 10 < a[i + 1] mod 10 then begin temp := a[i]; a[i] := a[i + 1]; a[i + 1] := temp; end; end; end;
writeln(); for i := 1 to n do write(A[i], ' '); end.
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.
var
A: array [1..10] of integer;
i, j, n, temp: integer;
begin
randomize();
n := 10;
for i := 1 to n do
begin
A[i] := random(100);
write(A[i], ' ');
end;
for j := 1 to n - 1 do
begin
for i := 1 to n - j do
begin
if a[i] mod 10 < a[i + 1] mod 10 then begin
temp := a[i];
a[i] := a[i + 1];
a[i + 1] := temp;
end;
end;
end;
writeln();
for i := 1 to n do
write(A[i], ' ');
end.