Cognizant Interview Question

asked me to write a code.