main.cpp 334 B

1234567891011121314151617181920
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int N;
  5. while (cin >> N) {
  6. if (N == 0) {
  7. break;
  8. }
  9. int result = 0;
  10. int val;
  11. for (int i = 0; i < N; i++) {
  12. cin >> val;
  13. result += val;
  14. }
  15. cout << result << endl;
  16. }
  17. return 0;
  18. }