INPUT "vvedite kol-vo elementov ryada ", n
DIM a(n)
RANDOMIZE TIMER
FOR i = 1 TO n
a(i) = INT(RND * 50)-20
NEXT
PRINT "ryad "
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT
FOR i = n TO 1 step-1
IF a(i) <0 THEN n1 = i
NEXT
FOR i = 1 TO n
IF a(i) <0 THEN n2 = i
NEXT
FOR i = n1+1 TO n2-1
FOR j = n1+2 TO n2-1
IF a(j) > a(j - 1) THEN SWAP a(j), a(j - 1)
NEXT
NEXT
PRINT "novyj ryad "
FOR i = n1+1 TO n2-1
PRINT a(i);
NEXT