Var i,j,max,maxj:integer; ar:array[1..n,1..n] of integer; begin randomize; max:=integer.MinValue; writeln('Array:'); for i:=1 to n do begin for j:=1 to n do begin ar[i,j]:=random(500); write(ar[i,j]:4); if ar[i,j]>max then begin max:=ar[i,j]; maxj:=j; end; end; writeln; end; max:=0; writeln; for i:=1 to n do max:=max+ar[i,maxj]; write('Res=',max); end.
Const
n=6;
Var
i,j,max,maxj:integer;
ar:array[1..n,1..n] of integer;
begin
randomize;
max:=integer.MinValue;
writeln('Array:');
for i:=1 to n do
begin
for j:=1 to n do
begin
ar[i,j]:=random(500);
write(ar[i,j]:4);
if ar[i,j]>max then
begin
max:=ar[i,j];
maxj:=j;
end;
end;
writeln;
end;
max:=0;
writeln;
for i:=1 to n do
max:=max+ar[i,maxj];
write('Res=',max);
end.