Var ma:array[1..n,1..n] of integer; i,j:integer; begin randomize; for i:=1 to n do begin for j:=1 to n do begin ma[i,j]:=random(50)-20; write(ma[i,j]:4); end; writeln; end; writeln('Сторки:'); for i:=1 to n do begin write(i,':'); for j:=1 to n do if ma[i,j]<0 then begin writeln(j); break; end; writeln; end; writeln('Столбцы:'); for j:=1 to n do begin write(j,':'); for i:=1 to n do if ma[i,j]<0 then begin writeln(i); break; end; writeln; end; end.
Answers & Comments
Verified answer
//Pascal ABC.NET v3.1 сборка 1172Const
n=4;
Var
ma:array[1..n,1..n] of integer;
i,j:integer;
begin
randomize;
for i:=1 to n do
begin
for j:=1 to n do
begin
ma[i,j]:=random(50)-20;
write(ma[i,j]:4);
end;
writeln;
end;
writeln('Сторки:');
for i:=1 to n do
begin
write(i,':');
for j:=1 to n do
if ma[i,j]<0 then
begin
writeln(j);
break;
end;
writeln;
end;
writeln('Столбцы:');
for j:=1 to n do
begin
write(j,':');
for i:=1 to n do
if ma[i,j]<0 then
begin
writeln(i);
break;
end;
writeln;
end;
end.