Cognizant Interview Question

Write the code for Fan to work.