INPUT "vvedite kol-vo elementov ", m
DIM a(m), b(m)
RANDOMIZE TIMER
PRINT "ishodnyj massiv"
FOR i = 1 TO m
a(i) = INT(RND * 50) - 25
PRINT a(i);
NEXT
PRINT
FOR i = 1 TO m
IF a(i) > 0 THEN k = k + 1: b(k) = a(i)
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 "novyj massiv"
FOR i = 1 TO k
PRINT b(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )