-3 2 8 -4 5 -1 Х
2 8 5 -3 -4 -1 Y
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) - 10
PRINT x(i);
NEXT
PRINT
FOR i = 1 TO n
IF x(i) >= 0 THEN k = k + 1: y(k) = x(i)
NEXT
FOR i = 1 TO n
IF x(i) < 0 THEN k = k + 1: y(k) = x(i)
NEXT
PRINT "massiv Y"
FOR i = 1 TO n
PRINT y(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )