Ответ:
var
arr: array[1..10] of integer;
i, k, j: integer;
begin
randomize;
writeln('Массив: ');
for i := 1 to 10 do arr[i] := random(10,99);
for i := 1 to 10 do
for k := 1 to 9 do
if (arr[k] mod 10) > (arr[k + 1] mod 10) then begin
j := arr[k];
arr[k] := arr[k + 1];
arr[k + 1] := j;
end;
for i := 1 to 10 do write(arr[i],' ');
end.
var a : array [1..10] of integer;
i, j, temp : integer;
write('Сгенерированный массив: ');
a[i] := random(90) + 10;
write(a[i], ' ');
for j := 1 to 9 do
if (a[j] mod 10) > (a[j+1] mod 10) then
temp := a[j];
a[j] := a[j+1];
a[j+1] := temp;
writeln;
write('Отсортированный массив: ');
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
var
arr: array[1..10] of integer;
i, k, j: integer;
begin
randomize;
writeln('Массив: ');
for i := 1 to 10 do arr[i] := random(10,99);
for i := 1 to 10 do
for k := 1 to 9 do
if (arr[k] mod 10) > (arr[k + 1] mod 10) then begin
j := arr[k];
arr[k] := arr[k + 1];
arr[k + 1] := j;
end;
for i := 1 to 10 do write(arr[i],' ');
end.
Verified answer
var a : array [1..10] of integer;
i, j, temp : integer;
begin
randomize;
write('Сгенерированный массив: ');
for i := 1 to 10 do
begin
a[i] := random(90) + 10;
write(a[i], ' ');
end;
for i := 1 to 10 do
for j := 1 to 9 do
begin
if (a[j] mod 10) > (a[j+1] mod 10) then
begin
temp := a[j];
a[j] := a[j+1];
a[j+1] := temp;
end;
end;
writeln;
write('Отсортированный массив: ');
for i := 1 to 10 do
write(a[i], ' ');
end.