Help in DECSTR

Can some one help me in this problem.

Here is the link to my code: https://www.codechef.com/viewsolution/19073338

Think about the condition when y=0.