fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int n;
  7. float liczba, suma=0;
  8. cin >> n;
  9.  
  10. int i=1;
  11. while (i<=n){
  12. cin >> liczba;
  13. cout << liczba << " ";
  14. suma = suma+liczba;
  15. i++;
  16. }
  17.  
  18. cout << endl<< "Srednia: " << suma/n << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5288KB
stdin
7
2 2 2 4 4 5 12
stdout
2 2 2 4 4 5 12 
Srednia: 4.42857