fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n = 0;
  7. double z;
  8. double sum = 0;
  9. while (cin >> z) {
  10. sum += z;
  11. n++;
  12. }
  13. cout << std::fixed << std::setprecision(2) << sum / n;
  14. return 0;
  15. }
Success #stdin #stdout 0s 4700KB
stdin
100.50 300.50
stdout
200.50