View Code of Problem 112

#include<stdio.h>
int main()
{
	int a,b,c;
	int t;
	while(scnaf("%d",t)!=EOF){
		sum = 0;
		if(t==0)
			break;
		while(t--){
			scanf("%d",&a);
			sum += a;
		}
		printf("%d\n",sum);
	}
    return 0;
}
/*
Main.c: In function 'main':
Main.c:6:2: warning: implicit declaration of function 'scnaf' [-Wimplicit-function-declaration]
  while(scnaf("%d",t)!=EOF){
  ^
Main.c:7:3: error: 'sum' undeclared (first use in this function)
   sum = 0;
   ^
Main.c:7:3: note: each undeclared identifier is reported only once for each function it appears in
Main.c:4:10: warning: unused variable 'c' [-Wunused-variable]
  int a,b,c;
          ^
Main.c:4:8: warning: unused variable 'b' [-Wunused-variable]
  int a,b,c;
        ^
*/

Double click to view unformatted code.


Back to problem 112