fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int cole[10];
  6. int sum = 0;
  7.  
  8. int main()
  9. {
  10. int a = 10;
  11. int b = 10;
  12. int c = 10;
  13. int d = 10;
  14. int e = 35;
  15. double avg = 0;
  16. cout << "Please input ten numbers, one at a time" << endl;
  17. for (int i=0;i<10;i++) {
  18. cin >> cole[i];
  19. }
  20. cout << "There will now be 5 assigned variables, so that we have 15 variables" << endl;
  21.  
  22. for(int x = 0; x < 10; x++ )
  23. {
  24. cout << cole[x] << " ";
  25. sum += cole[x];
  26. }
  27. cout << "and " << a << " " << b << " " << c << " " << d << " " << e << endl;
  28. cout << "The average of these numbers is: ";
  29. sum = sum + a + b + c + d + e;
  30. avg = sum / 15.0;
  31. cout << avg;
  32.  
  33. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
Please input ten numbers, one at a time
There will now be 5 assigned variables, so that we have 15 variables
0 0 0 0 0 0 0 0 0 0 and 10 10 10 10 35
The average of these numbers is: 5