INPUT "vvedite razmer matricy N= ", n
DIM a(n, n)
RANDOMIZE TIMER
FOR i = 1 TO n
FOR j = 1 TO n
a(i, j) = INT(RND * 21) - 10
NEXT
NEXT
PRINT "matrica"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT a(i, j); " ";
NEXT
PRINT
NEXT
FOR i = 1 TO n
s = 0
IF a(i, i) < 0 THEN FOR j = 1 TO n: s = s + a(i, j): NEXT: PRINT "stroka "; i; " summa="; s
NEXT
Тестирование выполнено в программе QB64 ( Скачать )