Recursion is a special case where function calls itself repeatedly.
main()
{
printf(“this is the example of recursion”);
main();
}
Another example is factorial:
Factorial of n=n(n-1)(n-2)…….1
Factorial of 4=4*3*2*1 =24
factorial(int n)
{
int fact;
if(n==1)
return 1;
else
fact=n*factorial(n-1);
return(fact);
}
Iteration Working
fact=3*factorial(2)
fact=3*2*factorial(1)
fact=3*2*1
fact=6