View Code of Problem 112

#include<bits/stdc++.h>
using namespace std; 
int main()
{
	int n;
	while(scanf("%d", &n) && n != 0)
	{
		int a[n], sum = 0;
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
			sum += a[i];
		}
		cout << sum << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 112