请计算下面每行数的和。
Input
输入包含多组数据,每组数据占一行。每行第一个数为整数N,后面有N个整数
Output
对于输入的每一行数,请分别对应输出每一行数的和。
Sample Input
4 1 2 3 4
5 1 2 3 4 5
Sample Output
10
15
Hint
本题相关知识:输入输出和循环语句(while)的使用方式。
和D同思路。。。。。
#include<stdio.h>
int main()
{
int i;
int a;
int n,m;
while(scanf("%d",&n)!=EOF)
{
int s=0;
while(n--)
{
scanf("%d",&a);
s+=a;
}
printf("%d\n",s);
}
return 0;
}