Can anybody please help me in fixing the bug in the code.

Thanks