View Code of Problem 112

#include<stdio.h>
main(){
	int n,a[100],i,s;
	s=0;
	while(scanf("%d",&n)!=EOF){
		if(n==0)
			break;
		else{
			for(i=0;i<n;i++){
				scanf("%d",&a[i]);
				s=s+a[i];
			}
			printf("%d\n",s);
			s=0;
		}
}
/*
Main.c:2:1: warning: return type defaults to 'int'
 main(){
 ^
Main.c: In function 'main':
Main.c:16:1: error: expected declaration or statement at end of input
 }
 ^
*/

Double click to view unformatted code.


Back to problem 112