CLS
INPUT "vvedite n"; n
DIM r(n), c(n)
FOR i = 1 TO n
PRINT "vvedite element"; i
INPUT r(i)
NEXT
FOR i = 1 TO n
IF r(i) > 0 THEN j = j + 1: c(j) = i
NEXT
PRINT "massiv r"
FOR i = 1 TO n
PRINT r(i);
NEXT
PRINT
PRINT "n ="; n
PRINT "new massiv c"
FOR i = 1 TO j
PRINT c(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )