View Code of Problem 112

#include<stdio.h>
int main()
{
	int n,i;
	int sum=0;
	scanf("%d",&n);
	int a[n];
	while(scanf("%d",&a[i])!=EOF&&i<n)
	{
		if(a[0]==0)
		{
			break;
		}
		else
		{
			sum+=a[i];
		}
		i++;
	}
	printf("%d",sum);
	return 0;
}

Double click to view unformatted code.


Back to problem 112