FarEye interview question

Question 1 ) write the program for