Const n=5;
var i,j:integer;
a:array[1..n,1..n] of integer;
Max:integer;
procedure p_max(input_mass:integer);
begin
if input_mass>Max then
Max:=input_mass;
end;
//Заполняем массив
procedure zapolnenue;
var i,j:integer;
begin
for i:=1 to n do
for j:=1 to n do
a[i,j]:=Random(1000);
end;
begin
Randomize;
zapolnenue;
writeln('Массив:');
for i:=1 to n do
begin
for j:=1 to n do
begin
write(a[i,j],' ');
p_max(a[i,j]);
end;
writeln;
end;
writeln;
writeln('Max = ',Max);
end.