DIM n AS INTEGER
DIM s AS SINGLE
RANDOMIZE TIMER
INPUT "Vvedite kol-vo indeksov massiva: ", n
DIM ar(1 TO n) AS SINGLE
s = 0
FOR i = 1 TO n
ar(i) = INT(RND * 100 - 50)
PRINT ar(i)
IF ar(i) >= 0 THEN
s = ar(i) + s
END IF
NEXT i
PRINT
PRINT "Summa polojitel'nih: "; s
END
Тестирование выполнено в программе QB64 ( Скачать )