fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long n, x;
  7. double sum = 0;
  8. cin >> n;
  9. for (int i = 1; i <= n; i++) {
  10. cin >> x;
  11. sum += x;
  12. }
  13. cout << fixed << setprecision(6) << sum / n << "\n";
  14. return 0;
  15. }
Success #stdin #stdout 0s 5524KB
stdin
3
7 4 5
stdout
5.333333