Const n=3; m=4; var a:array[1..n,1..m] of integer; i,j,max,imax,jmax:integer; begin writeln('Введите массив:'); for i:=1 to n do for j:=1 to m do read(a[i,j]); max:=a[1,1]; imax:=1; jmax:=1; for i:=1 to n do for j:=1 to m do if a[i,j]>max then begin max:=a[i,j]; imax:=i; jmax:=j; end; writeln('max = a[',imax,',',jmax,'] = ',max); end.
var
a:array[1..n,1..m] of integer;
i,j,max,imax,jmax:integer;
begin
writeln('Введите массив:');
for i:=1 to n do
for j:=1 to m do read(a[i,j]);
max:=a[1,1]; imax:=1; jmax:=1;
for i:=1 to n do
for j:=1 to m do
if a[i,j]>max then
begin max:=a[i,j]; imax:=i; jmax:=j; end;
writeln('max = a[',imax,',',jmax,'] = ',max);
end.
Пример:
Введите массив:
12 45 85 50
37 54 91 67
23 49 77 16
max = a[2,3] = 91