INPUT "vvedite kol-vo elementov ", n
DIM a(n)
RANDOMIZE TIMER
PRINT "posledovatelnost"
FOR i = 1 TO n
a(i) = INT(RND * 20)
PRINT a(i);
NEXT
PRINT
INPUT "vvedite chislo X ", x
FOR i = 1 TO n
IF a(i) = x THEN k = i
NEXT
IF k = 0 THEN PRINT "chislo x ne vstrchaetsya": END
FOR i = 1 TO k - 1
FOR j = 2 TO k - 1
IF a(j) > a(j - 1) THEN SWAP a(j), a(j - 1)
NEXT
NEXT
PRINT "novaya posledovatelnost"
FOR i = 1 TO n
PRINT a(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )