Infosys interview question

Question was related to general apptitue and Basic Coding