题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1092
代码:
#include <iostream>
#include<cstdio>
using namespace std;
int main()
{
int n;
int sum;
int x;
while(scanf("%d",&n) && n!=0)
{
sum=0;
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
sum=sum+x;
}
printf("%d\n",sum);
}
return 0;
}