Advertisement
Guest User

FiiPractic

a guest
Feb 17th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. int n,sumaP,sumaN,i,nr;
  2. double media=0;
  3. cin>>n;
  4. sumaP=0;
  5. sumaN=0;
  6. for(i=1;i<=n;i++)
  7. {
  8. cin>>nr;
  9. media=media+nr;
  10. if(nr<0)
  11. sumaN=sumaN+nr;
  12. if(nr>0)
  13. sumaP=sumaP+nr;
  14. }
  15. media=double(media/n);
  16. cout<<media;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement