半吊子

还是没有等到功成名就

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

Problem Description

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
代码:
#include<stdio.h>
int main()
{
    int a,sum=0;
        int m;
        while(scanf("%d",&m)!=EOF)
        {
        for(int i=1;i<=m;i++)
        {
        scanf("%d",&a);
           sum=sum+a;
       }
           printf("%d\n",sum);
               sum=0;
           }
   return 0; 
}
注意:没啥注意的 水
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhaihao1996/article/details/49950413
个人分类: hdoj a+b
上一篇hdoj A+B for Input-Output Practice (V)
下一篇hdoj A+B for Input-Output Practice (VII)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭