View Code of Problem 112

#include<algorithm>
#include<iostream>
#include<string>

using namespace std;

int main()
{
    int n;
	while(cin>>n)
    {
        if(n==0)
            break;
        long long sum=0;
        for(int i=0;i<=n;i++)
        {
            int temp;
            cin>>temp;
            sum+=temp;
        }
        cout<<sum<<endl;
    }
}

Double click to view unformatted code.


Back to problem 112