REM MATRIX
CLS: RANDOMIZE TIMER: CONST N = 7
DIM A(N, N)
A = -10: B = 10
FOR I = 1 TO N
FOR J = 1 TO N
A(I, J) = INT((B - A + 1) * RND + A)
NEXT J
NEXT I
FOR I = 1 TO N
FOR J = 1 TO N
PRINT USING "#### "; A(I, J);
NEXT J: PRINT
NEXT I
KOL_OTR_V_GL = 0
KOL_OTR_N_PO = 0
FOR I = 1 TO N
FOR J = 1 TO N
IF (I < J) AND (A(I, J) < 0) THEN KOL_OTR_V_GL = KOL_OTR_V_GL + 1
IF (J > N - I + 1) AND (A(I, J) < 0) THEN
KOL_OTR_N_PO = KOL_OTR_N_PO + 1
END IF
NEXT J
NEXT I
PRINT "KOLICHESTVO OTRITSATELNYKH VYSHE GLAVNOY:"; KOL_OTR_V_GL
PRINT "KOLICHESTVO OTRITSATELNYKH NIZHE POBOCHNOY:"; KOL_OTR_N_PO
PRINT: PRINT "POMENYAYEM MESTAMI PERVYY I POSLEDNIY ELEMENTY"
TEMP = A(1, 1)
A(1, 1) = A(N, N)
A(N, N) = TEMP
FOR I = 1 TO N
FOR J = 1 TO N
PRINT USING "#### "; A(I, J);
NEXT J: PRINT
NEXT I
END