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;
      scanf("%d ",&a);
      sum+=a;
      --N
    }
   }
 }//while
  printf("%d",sum);
}
/*
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:5: error: expected ';' before '}' token
     }
     ^
*/

Double click to view unformatted code.


Back to problem 112