标签:term tin tom other can main should gre class
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 108338 Accepted Submission(s): 57340
解题思路:先输入一个N,然后输入N个整数,N个整数相加的和输出出去。N为0的时候结束输入。
代码如下
#include <stdio.h> int main(void) { int a; int i, sum; int n; while (scanf_s("%d", &n) != EOF) { if (n != 0) { sum = 0; for (i = 0; i < n; i++) { scanf_s("%d", &a); sum += a; } printf("%d\n", sum); } else break; } return 0; }
标签:term tin tom other can main should gre class
原文地址:http://www.cnblogs.com/WLHBlog/p/7565295.html