CLS
RANDOMIZE TIMER
ny = 3
nx = 4
DIM a(ny, nx)
FOR y = 1 TO ny
FOR x = 1 TO nx
a(y, x) = FIX(RND * 86 + 15)
NEXT
NEXT
FOR y = 1 TO ny
FOR x = 1 TO nx
IF a(y, x) MOD 3 = 0 THEN k = k + 1
NEXT
NEXT
DIM b(k)
FOR y = 1 TO ny
FOR x = 1 TO nx
IF a(y, x) MOD 3 = 0 THEN i = i + 1: b(i) = a(y, x)
NEXT
NEXT
FOR i = 1 TO k
FOR j = 2 TO k
IF b(j) > b(j - 1) THEN SWAP b(j), b(j - 1)
NEXT
NEXT
PRINT "matrica"
FOR y = 1 TO ny
FOR x = 1 TO nx
PRINT a(y, x);
NEXT
PRINT
NEXT
PRINT "vektor A"
FOR i = 1 TO k
PRINT b(i);
NEXT
CLS
RANDOMIZE TIMER
ny = 3
nx = 4
DIM a(nx, ny)
FOR y = 1 TO ny
FOR x = 1 TO nx
a(x, y) = FIX(RND * 86 + 15)
NEXT
NEXT
FOR y = 1 TO ny
FOR x = 1 TO nx
IF a(x, y) MOD 3 = 0 THEN k = k + 1
NEXT
NEXT
DIM b(k)
FOR y = 1 TO ny
FOR x = 1 TO nx
IF a(x, y) MOD 3 = 0 THEN i = i + 1: b(i) = a(x, y)
NEXT
NEXT
FOR i = 1 TO k
FOR j = 2 TO k
IF b(j) > b(j - 1) THEN SWAP b(j), b(j - 1)
NEXT
NEXT
PRINT "matrica"
FOR y = 1 TO ny
FOR x = 1 TO nx
PRINT a(x, y);
NEXT
PRINT
NEXT
PRINT "vektor A"
FOR i = 1 TO k
PRINT b(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )