Pergunta de entrevista da empresa Cognizant

Write the code for Fan to work.