Răspuns:
#include <iostream>
using namespace std;
int main()
{
int n;
do{
cin>>n;
}while(n>100);
int v[100];
float maP=0.0f,maN=0.0f;
int cnt = 0;
for(int i = 0 ;i < n;i++){
cin>>v[i];
if(v[i]>0){
maP+=v[i];
cnt++;
}else{
maN+=v[i];
}
}
cout<<maP/cnt<<endl;
cout<<maN/(n - cnt);
}
Explicație: