INPUT "vvedite razmer massiva ", m
DIM z(m), y(m)
RANDOMIZE TIMER
PRINT "massiv Z"
FOR i = 1 TO m
z(i) = INT(RND * 20)
PRINT z(i);
NEXT
PRINT
FOR i = 1 TO m
sum = sum + z(i)
NEXT
sred = sum / m
PRINT "srednee="; sred
FOR i = 1 TO m
IF z(i) < sred THEN k = k + 1: y(k) = z(i)
NEXT
PRINT "massiv Y"
FOR i = 1 TO k
PRINT y(i);
NEXT
PRINT
FOR i = 1 TO k
FOR j = 2 TO k
IF y(j) < y(j - 1) THEN SWAP y(j), y(j - 1)
NEXT
NEXT
PRINT "otsortirovannyj massiv"
FOR i = 1 TO k
PRINT y(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )