#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; }
时间: 2024-10-06 16:37:04
#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; }