Pregunta de entrevista de Infosys

They asked me to write a code using recursive function