Sum of positive array elements
TypeScript
Easy
arrays
Task «Sum of positive array elements»
Write a program that reads a number N — the number of array elements, then N integers. It is necessary to calculate and output 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). In the second line, N integers separated by spaces.
Output Format
One integer — the sum of positive elements.
Examples
Example 1
INPUT
4
1 -2 3 -4
OUTPUT
4
Example 2
INPUT
1
7
OUTPUT
7
main.ts