uses crt;
const
sizeA = 4;
sizeB = 9;
a: array [1..sizeA, 1..sizeA] of real = ((5, 3, 2, 1), (4, -1, 2, -1), (3, 7, -9, 5), (-2, 1, 6, 1));
var
maxB, minB, maxA, minA, temp: real;
i, j: integer;
b: array[1..sizeB] of real = (4, 2, -1, 3, -9, 5, -2, 6, 1);
begin
minA := a[1, 1];
maxA := a[1, 1];
for i := 1 to sizeA do
for j := 1 to sizeA do
begin
if minA > a[i, j] then minA := a[i, j];
if maxA < a[i, j] then maxA := a[i, j];
end;
writeln('minA=', minA);
writeln('maxA=', maxA);
writeln('nesortovaniy masiv:');
minB := b[1];
maxB := b[1];
for i := 1 to sizeB do
begin
write(b[i], ' ');
if minB > b[i] then minB := b[i];
if maxB < b[i] then maxB := b[i];
end;
writeln;
writeln('minB=', minB);
writeln('maxB=', maxB);
writeln('sortovaniy masiv:');
for j := 1 to sizeB - 1 do
for i := 1 to sizeB - j do
if b[i] > b[i + 1] then
begin
temp := b[i];
b[i] := b[i + 1];
b[i + 1] := temp;
end;
for i := 1 to sizeB do
write(b[i], ' ');
readln;
end.