Case IQ interview question

Debugging from the given coding