Cognizant interview question

Based on basic programming