DIM a(5) AS SINGLE
DIM result() AS SINGLE
INPUT "Введите значения a1, a2, ..., an: ", a(0), a(1), a(2), a(3), a(4)
INPUT "Введите границы отрезка (c, d): ", c, d
FOR i = 0 TO 4
IF a(i) >= c AND a(i) <= d THEN
result(UBOUND(result) + 1) = a(i)
END IF
NEXT i
PRINT "Элементы на отрезке ["; c; ", "; d; "]:";
FOR i = LBOUND(result) TO UBOUND(result)
PRINT result(i);
NEXT i
Тестирование выполнено в программе QB64 ( Скачать )