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 lineFor each test case you should output the sum of N integers in one
#include <stdio.h>
int main() { int n, num, sum;
while (scanf("%d", &n) == 1) {
sum = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &num);
sum += num;
}
printf("%d\n", sum);
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/hfOo 著作权归作者所有。请勿转载和采集!