' Nasha matritsa
DATA 82,36,97,53
DATA 55,32,34,28
DATA 84,94,40,95
DATA -63,-71,-93,-94
' Programma
CLS
DIM M(4, 4)
' iy - nomer stroki, ix - nomer stolbtsa
FOR iy = 1 TO 4: FOR ix = 1 TO 4
READ M(ix, iy)
PRINT M(ix, iy);
NEXT: PRINT: NEXT
' Cumma otrits. el. pod diagonalyu.
FOR iy = 1 TO 4: FOR ix = 1 TO 4
IF iy > ix AND M(ix, iy) < 0 THEN Sum = Sum + M(ix, iy)
NEXT: NEXT
PRINT "Summa elem. nizhe diagonali:"; Sum
' Srednee arifmeticheskoe el-tov diagonali
Sr = M(1, 1)
FOR i = 2 TO 4: Sr = Sr + M(i, i): NEXT
PRINT "Srednee zn. elem. diagonali:"; Sr / 4
Тестирование выполнено в программе QB64 ( Скачать )