CLS
n = 5
DIM a(n, n)
RANDOMIZE TIMER
FOR i = 1 TO n
FOR j = 1 TO n
a(i, j) = INT(RND * 101) - 50
NEXT j
NEXT i
PRINT "Massiv"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT a(i, j);
NEXT j
PRINT
NEXT i
PRINT
p = 1: k = 0
FOR i = 1 TO n
IF a(i, i) MOD 2 = 1 THEN p = p * a(i, i): k = 1
NEXT i
IF k = 0 THEN
PRINT "v glavnoy diagonali net nechetnih elementov"
ELSE
PRINT "Proizvedenie nechetnih elementov v glavnoy diagonali="; p
END IF
END
Тестирование выполнено в программе QB64 ( Скачать )