Infosys interview question

Related to coding in basic programming