Например,
X:4 1 6 2 9 8
Y:1 3 4 6
INPUT "vvedite kol-vo elementov ", n
DIM x(n), y(n)
RANDOMIZE TIMER
PRINT "massiv x"
FOR i = 1 TO n
x(i) = INT(RND * 20)
PRINT x(i); " ";
NEXT
PRINT
FOR i = 1 TO n
IF x(i) MOD 2 = 0 THEN k = k + 1: y(k) = x(i)
NEXT
PRINT "massiv y"
FOR i = 1 TO k
PRINT y(i); " ";
NEXT
Тестирование выполнено в программе QB64 ( Скачать )