DIM a(100)
OPEN "input.txt" FOR INPUT AS #1
DO WHILE NOT EOF(1)
n = n + 1
INPUT #1, a(n)
LOOP
CLOSE
n = n - 1
PRINT "massiv"
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT
IF n MOD 3 <> 0 THEN
FOR i = 1 TO n
s = s + a(i)
NEXT
PRINT "srednee vseh chisel="; s / n
ELSE
PRINT "srednee troek"
FOR i = 1 TO n - 2
PRINT (a(i) + a(i + 1) + a(i + 2)) / 3;
NEXT
END IF