fork download
  1. #include <iostream>
  2. using namespace std;
  3. int x;
  4. int n;
  5. int main() {
  6. int Somma=0;
  7. n=10;
  8. for(int i=1; i<=n; i++)
  9. { cin>>x;
  10. Somma = Somma+x;
  11. }
  12. cout<<Somma<<endl;
  13. float Media= (float)Somma/n;
  14. cout<<Media;
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5324KB
stdin
1 2 3 4 5 6 7 8 9 10
stdout
55
5.5