Const N = 7; Var A:array[1..N,1..N] of integer; i,j,k:integer; Begin Randomize; For i:= 1 to N do Begin For j:= 1 to N do Begin A[i,j]:=random(21)-10; Write(A[i,j]:4) End; WriteLn End; k:=0; WriteLn; For i:= 1 to N do For j:= N-i+2 to N do if A[i,j]=0 then k:=k+1; WriteLn('k = ',k); ReadLn End.
Var
A:array[1..N,1..N] of integer;
i,j,k:integer;
Begin
Randomize;
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:4)
End;
WriteLn
End;
k:=0;
WriteLn;
For i:= 1 to N do
For j:= N-i+2 to N do
if A[i,j]=0 then k:=k+1;
WriteLn('k = ',k);
ReadLn
End.