SPOJ Digit Sum getting wrong ans

Problem - https://www.spoj.com/problems/PR003004/

My solution - https://ideone.com/8lmVno

Why i am getting wrong answer on submitting when it outputs correct answer for sample case?
Any help? Thank you in advance :slight_smile:

a and b can be as big as 1e15 and you are using int to store them.


Again silly mistake. Thank you for pointing it out.
I was scratching head since an hour trying different inputs and checking answer.

I know my post doesn’t help you at all, but I have to say this…
SPOJ sucks

I disagree. They actually have a good collection of classical problems.
It’s worth solving them.

The problems are really great, I’m saying that the platform sucks.

How ? \hspace{0mm}