#K33182. Count Positives and Sum Negatives
Count Positives and Sum Negatives
Count Positives and Sum Negatives
You are given an array of integers. Your task is to count the number of positive integers and to compute the sum of negative integers in the array. Zeros are ignored. The input starts with an integer (n) which denotes the number of elements in the array, followed by (n) space-separated integers. For example, if the input is 7
on the first line and 1 2 3 -1 -2 -3 -4
on the second line, the output should be 3 -10
.
inputFormat
The first line contains a single integer (n) representing the number of elements in the array. The second line contains (n) space-separated integers.
outputFormat
Output two space-separated integers: the count of positive numbers and the sum of negative numbers.## sample
7
1 2 3 -1 -2 -3 -4
3 -10