fork download
  1. #include <iostream>
  2. using namespace std;
  3. #define SIZE 10
  4.  
  5. int main() {
  6. int valor[SIZE];
  7. for (int i = 0; i < SIZE; i++) {
  8. cout << "Digite o valor: ";
  9. cin >> valor[i];
  10. }
  11. int total = 0;
  12. for (int i = 0; i < 10; i++) {
  13. cout << valor[i] << endl;
  14. total += valor[i];
  15. }
  16. cout << total;
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/460614/101
Success #stdin #stdout 0s 4368KB
stdin
1
2
3
4
5
6
7
8
9
0
stdout
Digite o valor: Digite o valor: Digite o valor: Digite o valor: Digite o valor: Digite o valor: Digite o valor: Digite o valor: Digite o valor: Digite o valor: 1
2
3
4
5
6
7
8
9
0
45