var a: array[1..m, 1..n] of integer; i, j, t: integer;
begin Randomize; Writeln('Исходный массив'); for i := 1 to m do begin for j := 1 to n do begin a[i, j] := Random(101) - 50; Write(a[i, j]:4) end; Writeln end; for j:=1 to n do begin t:=a[1,j]; a[1,j]:=a[3,j]; a[3,j]:=t end; Writeln('Полученный массив'); for i := 1 to m do begin for j := 1 to n do Write(a[i,j]:4); Writeln end end.
m = 5;
n = 8;
var
a: array[1..m, 1..n] of integer;
i, j, t: integer;
begin
Randomize;
Writeln('Исходный массив');
for i := 1 to m do
begin
for j := 1 to n do
begin
a[i, j] := Random(101) - 50;
Write(a[i, j]:4)
end;
Writeln
end;
for j:=1 to n do begin t:=a[1,j]; a[1,j]:=a[3,j]; a[3,j]:=t end;
Writeln('Полученный массив');
for i := 1 to m do
begin
for j := 1 to n do Write(a[i,j]:4);
Writeln
end
end.
Тестовое решение:
Исходный массив
45 20 -15 33 -37 26 -30 -3
-27 43 -24 4 -14 18 -50 5
-28 -47 11 27 -8 42 -19 -39
16 43 -18 0 -32 25 11 22
27 -37 -44 -38 -50 7 -45 -30
Полученный массив
-28 -47 11 27 -8 42 -19 -39
-27 43 -24 4 -14 18 -50 5
45 20 -15 33 -37 26 -30 -3
16 43 -18 0 -32 25 11 22
27 -37 -44 -38 -50 7 -45 -30