CLS
RANDOMIZE TIMER
INPUT "vvedite n"; n
DIM a(n)
FOR i = 1 TO n
a(i) = INT(RND * 5 - 2)
NEXT
FOR i = 1 TO n
IF a(i) = 0 THEN k = k + 1
NEXT
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT
PRINT "elementov = 0:"; k
Тестирование выполнено в программе QB64 ( Скачать )