Ans :
Within a function body, if the function calls itself, the mechanism is known as
‘Recursion’ and the function is known as ‘Recursive function’. Now let us study this
mechanism in detail and understand how it works.
• As we see in this mechanism, a chaining of function calls occurs, so it is
necessary for a recursive function to stop somewhere or it will result into
infinite callings. So the most important thing to remember in this mechanism is
that every “recursive function” should have a terminating condition.
• Let us take a very simple example of calculating factorial of a number, which
we all know is computed using this formula 5! = 54321
• First we will write non – recursive or iterative function for this.