INPUT " vvedite kol-vo elementov ", n
DIM y(n)
RANDOMIZE TIMER
PRINT "massiv"
FOR i = 1 TO n
y(i) = INT(RND * 20) - 10
PRINT y(i);
NEXT
PRINT
FOR i = 1 TO n
IF y(i) MOD 2 = 0 AND i MOD 2 <> 0 THEN s = s + y(i): m = m + 1
IF y(i) < 0 THEN k = k + 1: IF k = 2 THEN y(i) = 0: k = 3
NEXT
PRINT "srednee="; s / m
PRINT "novyj massiv"
FOR i = 1 TO n
PRINT y(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )