Home » C Programming » Recursion in C Programming

Recursion in C Programming

In C programming language, a function that calls itself is known as a recursive function. And, this technique is called as recursion.

 Recursive functions are very useful to solve many problems such as  Towers of Hanoi (TOH), Inorder/Preorder/Postorder Tree Traversals, DFS of Graph, etc.

How recursion works?

Example: Write a program in a C language to find the factorial using recursion.

OUTPUT

Example: Write a program in a C language to print the Fibonacci series using recursion.

Fibonacci series are 0, 1, 1, 2, 3, 5, 8, …,. 

In fibonacci series, except for the first two terms of the series, every other term is the sum of the previous two terms, for example, 5 = 2 + 3.

Please follow and like us:
error