Birlasoft interview question

Write a program for recursive function