CLS
n = 15
DIM a(n)
FOR i = 1 TO n
PRINT "vvedite element"; i
INPUT a(i)
NEXT
FOR i = 1 TO n
IF a(i) = 4 OR s <> 0 THEN s = s + a(i)
NEXT
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT
PRINT "summa:"; s
CLS
n = 15
DIM a(n)
FOR i = 1 TO n
PRINT "vvedite element"; i
INPUT a(i)
NEXT
FOR i = 1 TO n
IF a(i) = 4 OR z = 1 THEN s = s + a(i): z = 1
NEXT
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT
PRINT "summa:"; s
Тестирование выполнено в программе QB64 ( Скачать )