Pregunta de entrevista de Capgemini

Write a logic for specific case in c#