(HDU)1092 --A+B for Input-Output Practice (IV)(输入输出练习(IV))
#include <stdio.h> int main() { int n,i; while(~scanf("%d",&n)) { if(n==0) break; int a,sum = 0; for(i=1;i<=n;i++) { scanf("%d",&a); sum += a; } printf("%d\n",sum); } return 0; }
#include <stdio.h> int main() { int n,i; while(~scanf("%d",&n)) { if(n==0) break; int a,sum = 0; for(i=1;i<=n;i++) { scanf("%d",&a); sum += a; } printf("%d\n",sum); } return 0; }