[恢]hdu 1096
2011-12-14 05:16:49
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1096
题意:多组,输入n个数字,输出和。
代码:
# include <stdio.h>
int main ()
{
int sum, n, num ;
int flag = 0 ;
scanf ("%d", &n) ;
while (~scanf ("%d", &n))
{
sum = 0 ;
while (n--){
scanf ("%d", &num) ;
sum += num ;
}
if (flag == 0) flag = 1 ;
else puts ("") ;
printf ("%d\n", sum) ;
}
return 0 ;
}