Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- double n,a[11],sum=0,z=0;
- cin>>n;
- for(int i=0;i<n;i++)
- {cin>>a[i];if(a[i]>0){sum+=a[i];z+=1;}}
- if(z==0){cout<<"NO"<<endl;}else{cout<<fixed<<setprecision(2)<<sum/z<<endl;}
- return 0;
- }
Add Comment
Please, Sign In to add comment