Octal to binary question

My 1st and last test case is giving wrong answers. plz tell me whats wrong in this ? also , do you have any better / other approach to solve this?
link :https://ide.codingblocks.com/s/78365