const g = 5; v = 3;
var a: array[1..g,1..v] of integer;
i,j,maxj,minj,p:integer;
begin
writeln('Массив: ');
for i:=1 to g do
for j:=1 to v do
a[i,j]:=Random(101);
write(a[i,j]:4)
end;
writeln
maxj:=1;
minj:=1;
if a[i,j]>a[i,maxj] then maxj:=j;
if a[i,j]<a[i,minj]then minj:=j;
p:=a[i,maxj];
a[i,maxj]:=a[i,minj];
a[i,minj]:=p;
writeln;
writeln('Преобразованный массив: ');
for j:=1 to v do write(a[i,j]:4);
end.
var i,j,max,min,imax,imin:integer; A:array[0..5,0..3] of integer;
min:=101;
Randomize;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
A[i,j]:= random(100);
write(A[i,j]:3);
end;writeln;
writeln;writeln;
if A[i,j] > max then begin max:= A[i,j];imax:=j;end;
if A[i,j] < min then begin min:= A[i,j];imin:=j;end;
A[i,imin]:=max;
A[i,imax]:=min;
max:=0;min:=101;
imin:=0;imax:=0;
const g = 5; v = 3;
var a: array[1..g,1..v] of integer;
i,j,maxj,minj,p:integer;
begin
writeln('Массив: ');
for i:=1 to g do
begin
for j:=1 to v do
begin
a[i,j]:=Random(101);
write(a[i,j]:4)
end;
writeln
end;
for i:=1 to g do
begin
maxj:=1;
minj:=1;
for j:=1 to v do
begin
if a[i,j]>a[i,maxj] then maxj:=j;
if a[i,j]<a[i,minj]then minj:=j;
end;
p:=a[i,maxj];
a[i,maxj]:=a[i,minj];
a[i,minj]:=p;
end;
writeln;
writeln('Преобразованный массив: ');
for i:=1 to g do
begin
for j:=1 to v do write(a[i,j]:4);
writeln
end;
end.
var i,j,max,min,imax,imin:integer; A:array[0..5,0..3] of integer;
begin
min:=101;
Randomize;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
A[i,j]:= random(100);
write(A[i,j]:3);
end;writeln;
end;
writeln;writeln;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
if A[i,j] > max then begin max:= A[i,j];imax:=j;end;
if A[i,j] < min then begin min:= A[i,j];imin:=j;end;
end;
A[i,imin]:=max;
A[i,imax]:=min;
max:=0;min:=101;
imin:=0;imax:=0;
end;
writeln;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
write(A[i,j]:3);
end;writeln;
end;
end.