Advertisement
rengetsu

ProcedurProgramavimas_2.02

Mar 12th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main() {
  5. double n, z[11], sum=0, q=0;
  6. cin>>n;
  7. for(int i=0;i<n;i++)
  8. {
  9.   cin>>z[i];
  10.     if(z[i]<0){
  11.   sum+=z[i];
  12.         q+=1;
  13.     }
  14. }
  15.     if(sum==0){cout<<"NO"<<endl;}
  16.     else{
  17. cout<<fixed<<setprecision(2)<<sum/q<<endl;
  18.     }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement