question link-https://hack.codingblocks.com/contests/c/509/195 my solution - https://ide.codingblocks.com/#/s/28788
https://ide.codingblocks.com/#/s/28881
endl was missing in the default case.