Question d’entretien chez Infosys

Write the program for the given problem