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