Infosys interview question

An easy coding problem