Infosys interview question

Pattern based coding question is asked.