Can you please tell me why this code is not passing all the test cases

Please help me by telling why this code is not passing all the test cases

@KetanPandey
Consider this testcase:
2
9 0
2
9 0
output should be “1, 8, 0, END” but your code is giving “8, 0, END”. This is because when c is not equal to zero at the end, you have done a[z]=c; but you haven’t increment z. Since while printing final array you starts from i=z-1, you have missed the carry.
just change line 54 to { a[z]=c; z++; }. You code will work for all testcase

ok i got it and its wori

ok i got it and its working.But if i do not increment z and start loop from i=z,than its not working,can you explain why?

@KetanPandey
It won’t work if there isn’t any carry at the end. It will print some random character it zth index if there isn’t any carry.