Sum of positive array elements
C++
Easy
arrays
Task «Sum of positive array elements»
Given an array of integers. Write a program that finds the sum of all positive elements of the array. If there are no positive elements, output 0.
Input Format
In the first line, an integer N (1 ≤ N ≤ 1000) is entered — the number of elements in the array. In the second line, N integers are entered separated by spaces, each not exceeding 1000 in absolute value.
Output Format
Output a single integer — the sum of positive elements.
Examples
Example 1
INPUT
6
1 -2 3 -4 5 -6
OUTPUT
9
Example 2
INPUT
3
0 0 0
OUTPUT
0
main.cpp