{$APPTYPE CONSOLE} Type Mass = array of array of integer; Procedure KP(Var A:Mass; N:integer); Var i,j,k:integer; Begin k:=0; For j:= 0 to N-1 do if j mod 2 = 0 then For i:= 0 to N-1 do if A[i,j] > 0 then k:=k+1; WriteLn('k = ',k) End;
Procedure RND(Var A:Mass; N:integer); Var i,j:integer; Begin Randomize; SetLength(A,N,N); For i:= 0 to N-1 do Begin For j:= 0 to N-1 do Begin A[i,j]:=random(21)-10; Write(A[i,j]:3,' ') End; WriteLn End; End; Var A,B:Mass; N,M:integer; Begin Write('N = ');ReadLn(N); WriteLn('A(',N,',',N,'):'); RND(A,N); KP(A,N); Write('M = ');ReadLn(M); WriteLn('B(',M,',',M,'):'); RND(B,M); KP(B,M); ReadLn End.
Type
Mass = array of array of integer;
Procedure KP(Var A:Mass; N:integer);
Var i,j,k:integer;
Begin
k:=0;
For j:= 0 to N-1 do
if j mod 2 = 0 then
For i:= 0 to N-1 do
if A[i,j] > 0 then k:=k+1;
WriteLn('k = ',k)
End;
Procedure RND(Var A:Mass; N:integer);
Var i,j:integer;
Begin
Randomize;
SetLength(A,N,N);
For i:= 0 to N-1 do
Begin
For j:= 0 to N-1 do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
End;
Var
A,B:Mass;
N,M:integer;
Begin
Write('N = ');ReadLn(N);
WriteLn('A(',N,',',N,'):');
RND(A,N);
KP(A,N);
Write('M = ');ReadLn(M);
WriteLn('B(',M,',',M,'):');
RND(B,M);
KP(B,M);
ReadLn
End.