CLS
INPUT "vvedite m"; m
DIM a(m), b(m)
FOR i = 1 TO m
INPUT "vvedite element"; a(i)
NEXT
FOR i = 1 TO m
IF a(i) MOD 3 = 0 THEN k = k + 1: b(k) = a(i): sr = sr + a(i)
NEXT
sr = sr / k
PRINT "massiv"
FOR i = 1 TO m
PRINT a(i);
NEXT
PRINT
PRINT "new massiv"
FOR i = 1 TO k
PRINT b(i);
NEXT
PRINT
PRINT "sr ="; sr
Тестирование выполнено в программе QB64 ( Скачать )