Дан одномерный массив Zm. Массив-Zm отсортировать по убыванию- Basic(Бейсик)

INPUT "vvedite kol-vo elementov ", n
DIM z(n)
RANDOMIZE TIMER
PRINT "massiv Z"
FOR i = 1 TO n
z(i) = INT(RND * 20)
PRINT z(i);
NEXT
PRINT
FOR i = 1 TO n
IF z(i) > i THEN k = k + 1: x(k) = z(i)
NEXT
PRINT "massiv X"
FOR i = 1 TO k
PRINT x(i);
NEXT
PRINT
FOR i = 1 TO k
FOR j = 2 TO k
IF x(j) > x(j - 1) THEN SWAP x(j), x(j - 1)
NEXT
NEXT
PRINT "otsortirovannyj massiv"
FOR i = 1 TO k
PRINT x(i);
NEXT

Leave a Comment