a+b

点击打开链接


Your task is to calculate the sum of some integers. 
Input
Input contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line. 
Output
For each test case you should output the sum of N integers 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
Sample Output
10
15





这虽然是道水题,但它却是我自己做出来的


#include<stdio.h>
int main()
{
int i;
while(scanf("%d",&i)!=EOF)
{
int sum=0;
for(int n=0;n<i;n++)
{
int a[100];
scanf("%d",&a[n]);
sum+=a[n];

}
printf("%d\n",sum);
}
return 0;
}



posted @ 2017-07-24 22:37  Veritas_des_Liberty  阅读(230)  评论(0编辑  收藏  举报