#K9391. Sum of Positive Numbers
Sum of Positive Numbers
Sum of Positive Numbers
Given an array of integers, compute the sum of all positive numbers in the array. If there are no positive numbers, the output should be 0. In mathematical notation, for an array \(\{a_1, a_2, \dots, a_n\}\), you are to compute \(S = \sum_{i=1}^{n} \max(a_i, 0)\).
inputFormat
The input is given via stdin in the following format:
- The first line contains an integer \(n\) representing the number of elements.
- The second line contains \(n\) space-separated integers.
outputFormat
Output via stdout a single integer which is the sum of all positive numbers in the array.
## sample5
1 -2 3 4 -5
8