- A function that called itself is known as recursive function and the process of calling function itself is known as Recursion.
- The default data structure used in recursion is STACK.
- Recursion works slower than loop.
- Recursion is more alignment few variable,which make program clean.
- It is hard to think a logic of recursive function it is also difficult to debug the code containing recursion.
img credit:Google Images |
#include<stdio.h>
#include<conio.h>
main()
{int num=0 res=0;
printf("Enter the number");
scanf("%d".&num);
res=fact_N(num);
printf("\n Factorial of %d %d",num,res);
getch();
}
fact_N(intx)
{int f=0;
if(x==1)
return1;
else
f=x*fact_N(x-1);
returnf;
}
I hope series of Function is useful to you
ReplyDelete