Advertisement
alexon5519

17-4

Oct 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream.h>
  3. #include<iomanip.h>
  4. int main(){
  5. ifstream f1("numere.txt");
  6. int x,i=0;
  7. float ma,s=0;
  8. while(f1>>x)
  9. if(x>0){
  10. s=s+x;
  11. i++;}
  12. ma=s/i;
  13. f1.close();
  14. cout<<fixed<<setprecision(2)<<ma;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement