hdoj A+B for Input-Output Practice (IV)

Input

Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.

Output

For each group of input integers you should output their sum in one line, and with one line of output for each line in input.

Sample Input

4 1 2 3 4
5 1 2 3 4 5
0


Sample Output

10
15

代码：
#include<stdio.h>
int main()
{
int n,a,sum=0;
while(scanf("%d",&n)&&n)
{
while(n--)
{
scanf("%d",&a);
sum=sum+a;
}
printf("%d\n",sum);
sum=0;
}
return 0;
}

注意：题目要求n=0时结束

[水题][hdoj_1096]A+B for Input-Output Practice (VIII)

2012-07-31 01:42:21

[水题][hdoj_1092]A+B for Input-Output Practice (IV)

2012-07-31 01:06:45

[水题][hdoj_1094]A+B for Input-Output Practice (VI)

2012-07-31 01:20:16

[1092]：A+B for Input-Output Practice (IV)

2015-11-15 13:55:08

HDU-1092-A+B for Input-Output Practice (IV)(继续！)

2015-07-15 14:08:48

ACM STEP 1.1.4 A+B for Input-Output Practice (IV)

2013-10-11 19:51:13

1408181855-hd-A+B for Input-Output Practice (IV).cpp

2014-08-18 18:55:50

1096:A+B for Input-Output Practice (VIII)

2014-04-11 17:42:02

[水题][hdoj_1091]A+B for Input-Output Practice (III)

2012-07-31 00:48:32

【杭电oj】1090 - A+B for Input-Output Practice (II)

2016-01-13 20:42:09