Const m=4; n=5;
var
a:array[1..m,1..n] of real;
i,j:integer; max:real;
begin
Randomize;
writeln('Исходный массив:');
for i:=1 to m do
begin
for j:=1 to n do
begin
a[i,j]:=random(10);
write(a[i,j]:5:1);
end;
writeln;
end;
max:=a[1,1];
for i:=1 to m do
for j:=1 to n do
if a[i,j]>max then max:=a[i,j];
writeln('max = ',max);
for i:=1 to m do
for j:=1 to n do
if a[i,j]=max then a[i,j]:=a[i,j]/2;
writeln('Полученный массив:');
for i:=1 to m do
begin
for j:=1 to n do write(a[i,j]:5:1);
writeln;
end;
end.
Пример:
Исходный массив:
1.0 9.0 1.0 9.0 8.0
4.0 4.0 5.0 9.0 9.0
6.0 3.0 6.0 0.0 6.0
6.0 7.0 3.0 6.0 9.0
max = 9
Полученный массив:
1.0 4.5 1.0 4.5 8.0
4.0 4.0 5.0 4.5 4.5
6.0 3.0 6.0 0.0 6.0
6.0 7.0 3.0 6.0 4.5