Link Search Menu Expand Document

Sum of Positives

Print the sum of all positive numbers in a given array of integers.

E.g. for [1, -3, 5, -1, 2] the output should be 8 (i.e. 1 + 5 + 2)