View Code of Problem 112

#include <stdio.h>
int main()
{
 int N,sum=0;
 while(scanf("%d ",&N)!=EOF)
 {
   if(N=0)
     break;
   else
   {
    while(N>0)
    {
      int a;
      if(N==1)
        scanf("%d",&a);
      else
        scanf("%d ",%a);
      sum+=a;
      --N;
    }
   }
   printf("%d\n",sum);
   sum=0;
 }//while
  
}
/*
Main.c: In function 'main':
Main.c:7:4: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
    if(N=0)
    ^
Main.c:17:21: error: expected expression before '%' token
         scanf("%d ",%a);
                     ^
*/

Double click to view unformatted code.


Back to problem 112