Pregunta de entrevista de Cognizant

Write the code for Fan to work.