Const
N = 4;
Var
A:array[1..N,1..N] of integer;
i,j,k:integer;
Begin
Randomize;
WriteLn('1)');
k:=0;
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ');
if A[i,j] < 0 then k:=k+1;
End;
WriteLn
End;
WriteLn('k = ',k);
WriteLn('2)');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
if j > i then A[i,j]:=100;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
WriteLn('3)');
For i:= 1 to N div 2 do
Begin
For j:= 1 to N do
Begin
k:=A[i+N div 2,j];
A[i+N div 2,j]:=A[i,j];
A[i,j]:=k;
End
End;
For i:= 1 to N do
Begin
For j:= 1 to N do
Write(A[i,j]:3,' ');
WriteLn
End;
End.
1)
10 2 -9 4
-10 5 -5 -10
4 9 4 10
3 -9 10 -6
k = 6
2)
10 100 100 100
-10 5 100 100
4 9 4 100
3 -9 10 -6
3)
4 9 4 100
3 -9 10 -6
10 100 100 100
-10 5 100 100