View Code of Problem 112

#include<bits/stdc++.h>
using namespace std;
 
 
int main() {
	int n;
	while (cin >> n) {
		int x, sum = 0;
		if (n == 0) {
			break;
		}
		else {
			while (n--) {
				cin >> x;
				sum += x;
			}
			cout << sum << endl;
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 112