cls
input n
dim a(n)
randomize timer
for i =1 to n
a(i)=int(rnd(1)*50 +1)
next i
for i= 1 to n
? a(i)
next i
for i=1 to n
if a(i)=0 then ?i;
next
CLS
INPUT n
DIM a(n)
RANDOMIZE TIMER
FOR i =1 TO n
a(i)=INT(RND(1)*20 +1)
NEXT i
PRINT "Ishodniy massiv"
FOR i= 1 TO n
PRINT a(i);
NEXT i
k=0
PRINT
FOR i=1 TO n
IF a(i)=0 THEN k=k+1
NEXT i
IF k=0 THEN
PRINT "V ishodnom massive net nulevih elementov"
ELSE
DIM b(k):p=0
FOR i=1 TO n
IF a(i)=0 THEN p=p+1: b(p)=i
NEXT i
PRINT "Massiv nomerov nulevih elementov"
FOR i=1 TO k
PRINT b(i);
NEXT i
END IF
Тестирование выполнено в программе QB64 ( Скачать )