CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*Sum Positive & Count Negative
[CHALLENGE] sum positive count negative
From r8w9
Make a function that calculates sum of positive numbers and counts negative numbers.
Given array = [1,2,3,4,5,-1,-2,-3,-4,-5]
Output:
sum of positive numbers = 15
count of negative numbers = 5
*/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n(0),s(0),c(0),i(0),a(0);
vector<int> values;
cout<<"Number of values :";cin>>n;
do
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run