Infosys Interview Question

Basic programming which is asked.