uses crt;
const n=8;
m=7;
Type arr=array[1..n,1..m] of integer;
function KolOtr(a:arr; var k1:integer):integer;
var i,j:integer;
begin
k1:=0;
for i:=1 to n do
for j:=1 to m do
if a[i,j]<0 then
k1:=k1+1;
end;
var a:arr;
i,j,k:integer;
begin
ClrScr;
Randomize;
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(20)-10;
Write(a[i,j]:4);
end;
Writeln;
end;
Writeln;
KolOtr(a,k);
Writeln('K=',k);
Readln;
end.
Вариант 2
uses
crt;
type
MyArr=array[1..100,1..100]of integer;
procedure Writing(var a:MyArr;const str,col:integer);
var
i,j:integer;
begin
writeln('=...');
for i:=1 to str do
for j:=1 to col do
begin
write('= a[',i,',',j,']=');
readln(a[i,j])
end;
end;
procedure Print(const a:MyArr;str,col:integer;ch:char);
var
i,j:integer;
begin
writeln('= ',ch,' [',str,'X',col,']:');
for i:=1 to str do
begin
for j:=1 to col do
write(a[i,j]:2,' ');
writeln
end
end;
function Count(const a:MyArr; str,col:integer):integer;
var
i,j,c:integer;
begin
c:=0;
for i:=1 to str do
for j:=1 to col do
if a[i,j]<0 then
inc(c);
Count:=c
end;
var
a:MyArr;
str,col:integer;
begin
WriteLn('=...');
ReadLn(str,col);
Writing(a,str,col);
Print(a,str,col,'A');
WriteLn('Itogo: ',Count(a,str,col))
end.