You are given a two-dimensional array A with dimensions M * N. Sort all rows in ascending order of element values.

program arrays_19;
const n = 10; m = 10;
var i, j, k, p, ch, key1, key2: integer;
a: array [1..n, 1..m] of integer;
begin
for i: = 1 to n do begin
for j: = 1 to m do begin
a [i, j]: = random (10); // fill the array with random numbers and display
write (a [i, j]: 3);
end;
writeln;
end;
for i: = 1 to n do begin // sort each line in ascending order
for j: = 1 to m do begin
for k: = 1 to 9 do begin
key2: = k;
ch: = a [j, k];
if a [j, key2]> a [j, k + 1]
then key2: = k + 1;
a [j, k]: = a [j, key2];
a [j, key2]: = ch

end;
end;
end;
writeln; write (‘Sorted array:’);
writeln;
for i: = 1 to n do begin // output the answer
for j: = 1 to m do begin
write (a [i, j]: 3);
end;
writeln;
end;
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.