program mas2_min_max;
const
n=7;
var
a:array[1..n,1..n] of integer;
i,j,max:integer;
begin
writeln('Массив 》');
for i:=1 to n do
for j:=1 to n do
a[i,j]:=random(41)-20;
write(a[i,j]:3,' ');
end;
writeln;
max:=-22;
if (max<a[i,j])and(a[i,j]<0) then
max:=a[i,j];
writeln('Максимальный отрицательный элемент 》',max);
end.
===== PascalABC.NET =====
var a := MatrRandom(7, 7, -20, 20);
a.Println;
a.ElementsByRow.Where(p -> p < 0).Max.Print
program mas2_min_max;
const
n=7;
var
a:array[1..n,1..n] of integer;
i,j,max:integer;
begin
writeln('Массив 》');
for i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=random(41)-20;
write(a[i,j]:3,' ');
end;
writeln;
end;
max:=-22;
for i:=1 to n do
for j:=1 to n do
begin
if (max<a[i,j])and(a[i,j]<0) then
max:=a[i,j];
end;
writeln('Максимальный отрицательный элемент 》',max);
end.
===== PascalABC.NET =====
begin
var a := MatrRandom(7, 7, -20, 20);
a.Println;
a.ElementsByRow.Where(p -> p < 0).Max.Print
end.