getting wrong answer

int main(){
int n,c,t,k,a[100];
long unsigned int candy;
for(k=0,c=0;k<n;k++) {scanf("%d",&a[k]); c=c+a[k];}
if(candy<c) printf(“No”);
else printf(“Yes”);}
return 0;

it’s not working fine for input from problem statement -

1 Like

I edited it a bit. changed %d to %llu.

But check here , the value of t drops from 2 to 0 in the loop. I am confused from this.

I changed long unsigned int candy to unsigned long long candy, see maybe some C++ guru can describe in detail, I’m Java guy…

The mistake is small.

There is missing ‘\n’ in both printf
printf(“Yes\n”); and printf(“No\n”);

If still there is problem, comment below.