DIM m(20)
FOR i = 1 TO 20
INPUT "vvedite element ", m(i)
NEXT
INPUT "vvedite nachalo intervala a= ", a
INPUT "vvedite konec intervala b= ", b
INPUT "vvedite chislo p= ", p
PRINT "massiv"
FOR i = 1 TO 20
PRINT m(i); " ";
NEXT
PRINT
FOR i = 1 TO 20
IF (m(i) >= a) AND (m(i) <= b) THEN s = s + m(i)
NEXT
PRINT "summa="; s
PRINT "p="; p
min = m(1)
nmin = 1
max = m(1)
nmax = 1
FOR i = 1 TO 20
IF m(i) > max THEN max = m(i): nmax = i
IF m(i) < min THEN min = m(i): nmin = i
NEXT
IF s > p THEN PRINT "min="; min; " ego indeks="; nmin ELSE IF s < p THEN PRINT "max="; max; " ego indeks="; nmax ELSE PRINT "s=p"
Результат работы программы
Тестирование выполнено в программе QB64 ( Скачать )