CLS
INPUT n
RANDOMIZE TIMER
DIM a(n), b(n)
FOR i = 1 TO n
a(i) = INT(RND * 99)
NEXT i
FOR i = 1 TO n
PRINT a(i);
NEXT i
PRINT
INPUT "r=", r
INPUT "u=", u
j = 0
FOR i = 1 TO n
IF ABS(a(i) - r) < u THEN
j = j + 1
b(j) = i
END IF
NEXT i
FOR i = 1 TO j
PRINT b(i);
NEXT i
Тестирование выполнено в программе QB64 ( Скачать )