Need help in code!

Please look in my code:
https://ide.codingblocks.com/s/69441

If we put the input 4, last line contains 1 2 3 4 4 3 2 1. What changes should i make in order to remove that one extra 4?

Ankush i have changed code and mark the changes just go through it
check this https://ide.codingblocks.com/s/69446

Hey Ankush,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.