CLS
DIM b(30)
DIM a(1 TO 30), y, x, s AS INTEGER
RANDOMIZE TIMER
FOR x = 1 TO 30
a(x) = INT(RND * 100) - 50
PRINT a(x);
NEXT x
s = 0
FOR x = 1 TO 30
IF x MOD 2 = 0 THEN s = s + 1
NEXT x
DIM b(1 TO s) AS INTEGER
y = 1
FOR x = 1 TO 30
IF a(x) MOD 2 = 0 THEN
b(y) = a(x)
y = y + 1
END IF
NEXT x
PRINT
PRINT
FOR y = 1 TO s
NEXT y
PRINT b(y);
END
Тестирование выполнено в программе QB64 ( Скачать )