fork download
  1. #include <iostream>
  2. using namespace std;
  3. int somma=0;
  4. int i;
  5. int voto;
  6. int main() {
  7.  
  8. for (i=1; i<=10; i++)
  9. {cin>>voto;
  10. somma=somma+voto;}
  11. cout<<"somma= "<<somma<<endl;
  12. float Media =somma/10; // float Media =somma/10.0;
  13. cout<<"media= "<<Media<<endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 5276KB
stdin
6
8
9
5
7
8
8
9
6
10
stdout
somma= 76
media= 7