1 #include <stdio.h> 2 int main() 3 { 4 int i,n,a,sum=0; 5 while(scanf("%d",&n)!=EOF){ 6 for(i=0;i<n;i++){ 7 scanf("%d",&a); 8 sum+=a; 9 } 10 printf("%d ",sum); 11 sum=0; 12 } 13 return 0; 14 }
1 #include <stdio.h> 2 int main() 3 { 4 int i,n,a,sum=0; 5 while(scanf("%d",&n)!=EOF){ 6 for(i=0;i<n;i++){ 7 scanf("%d",&a); 8 sum+=a; 9 } 10 printf("%d ",sum); 11 sum=0; 12 } 13 return 0; 14 }