CLS
RANDOMIZE TIMER
n = 5: p = 1
DIM a(n, n)
FOR i = 1 TO n
FOR j = 1 TO n
a(i, j) = FIX(RND * 99 + 1)
NEXT
NEXT
FOR i = 1 TO n
FOR j = 1 TO n
IF i = j THEN s = s + a(i, j)
IF i = n - j + 1 THEN p = p * a(i, j)
NEXT
NEXT
FOR i = 1 TO n
FOR j = 1 TO n
PRINT a(i, j);
NEXT
PRINT
NEXT
PRINT "s ="; s
PRINT "p ="; p
Тестирование выполнено в программе QB64 ( Скачать )