### Control Statement 6

#### Description:

Problem Description Write a program which takes input 10 integer array which contains positive and negative numbers and find out the average of positive and average of negative numbers. Test Case 1 Input (stdin) 10 5 -5 -10 2 -2 -3 3 15 -15 Expected Output The total of negative numbers=-35 The total of positive numbers=35 The average of negative numbers=-7 The average of positive numbers=7 Test Case 2 Input (stdin) 10 -9 8 -7 6 -5 4 -3 2 -1 Expected Output The total of negative numbers=-25 The total of positive numbers=30 The average of negative numbers=-5 The average of positive numbers=6

#### Program :

#include <iostream>
using namespace std;
int main()
{
int a,i,ne=0,po=0,n=0,m=0;
for(i=0;i<10;i++)
{
cin>>a[i];
if(a[i]>0)
{
po=po+a[i];
m++;
}
else{
ne=ne+a[i];
n++;
}}
cout<<"The total of negative numbers="<<ne;
cout<<" The total of positive numbers="<<po;
cout<<" The average of negative numbers="<<ne/n;
cout<<" The average of positive numbers="<<po/m;
return 0;
}