INPUT n
DIM a(n)
RANDOMIZE TIMER
FOR i = 1 TO n
a(i) = INT(RND * 20) - 10
PRINT a(i); " ";
NEXT
FOR i = 1 TO n
IF (a(i) < 0) AND (a(i) MOD 2 = 1) THEN s = s + a(i)
NEXT
PRINT s
Тестирование выполнено в программе QB64 ( Скачать )
INPUT n
DIM a(n)
RANDOMIZE TIMER
FOR i = 1 TO n
a(i) = INT(RND * 20) - 10
PRINT a(i); " ";
NEXT
FOR i = 1 TO n
IF (a(i) < 0) AND (a(i) MOD 2 = 1) THEN s = s + a(i)
NEXT
PRINT s
Тестирование выполнено в программе QB64 ( Скачать )