Răspuns :

#include <iostream>

using namespace std;

int main() {

int n, v[1001], s=0, k=0;

cout<<"nr elem: ", cin>>n;

cout<<"cititi elementele"<<endl;

for (int i=1; i<=n; i++) {cin>>v[i]; if (v[i]>=0) {s+=v[i]; k++;}}

if (k!=0) cout<<s/k;

else cout<<"nu exista elem pozitive";

return 0;

}