CLS
n = 100
DIM a(n)
RANDOMIZE TIMER
FOR i = 1 TO n
a(i) = INT(RND * 31) - 20
NEXT i
PRINT "Ishodniy Massiv"
FOR i = 1 TO n
PRINT a(i);
NEXT i
PRINT "Otricatelnie chisla"
s = 0
FOR i = 1 TO n
IF a(i) < 0 THEN
PRINT a(i);
s = s + a(i)
END IF
NEXT i
PRINT
PRINT "Summa Otricatelnih chisel="; s
Тестирование выполнено в программе QB64 ( Скачать )