CLS
n = 10
DIM a(n)
FOR i = 1 TO n
PRINT "vvedite a("; i; ")"
INPUT a(i)
NEXT
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT STRING$(80, 196)
FOR i = 2 TO n - 1
IF a(i) < (a(i - 1) + a(i + 1)) / 2 THEN PRINT a(i);
NEXT
CLS: n = 10: DIM a(n): RANDOMIZE TIMER
PRINT "avtomaticheskij vvod sluchajnyh chisel iz zadannogo diapazona(nazhmite 1)"
PRINT "vvod chisel v ruchnuju(nazhmite 2)"
DO
q$ = INKEY$
LOOP UNTIL q$ = CHR$(49) OR q$ = CHR$(50)
SELECT CASE q$
CASE IS = CHR$(49)
INPUT "vvedite nachala diapazona"; a
INPUT "vvedite konec diapazona"; b
FOR i = 1 TO n
a(i) = INT(RND * ABS(b - a + 1) + a)
NEXT
CASE IS = CHR$(50)
FOR i = 1 TO n
PRINT "vvedite a("; i; ")"
INPUT a(i)
NEXT
END SELECT
PRINT STRING$(80, 196)
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT STRING$(80, 196)
PRINT "chisla menshe polusummy:"
FOR i = 2 TO n - 1
IF a(i) < (a(i - 1) + a(i + 1)) / 2 THEN PRINT a(i);: k = k + 1
NEXT
PRINT
PRINT "kollichestvo chisel:"; k
Тестирование выполнено в программе QB64 ( Скачать )