Infosys interview question

Hard coding question and printf won’t work