Table of Contents
Recursion in C Programming
Recursion : “The repeated application of a recursive procedure or definition.” – Oxford Languages.
In programming we have recursion functions, these functions are the functions which call themselves in the same function.
In simple words if any function calls itself then it is known as recursion.
E.g.
int fact()
{
fact();
}
int main()
{
fact();
}
Recursion is a little bit tough to handle especially when it comes to exit conditions.
If the exit condition is not properly handled then the program will be stuck in an infinite loop.
Recursion is helpful to solve mathematical problems e.g. finding factorial

Function recursion program in C
#include <stdio.h>
//itvoyagers.in
int fact(int x)
{
if(x != 0)
{
return x * fact(x-1);
}
else
{
return 1;
}
}
//itvoyagers.in
int main()
{
int num,rsl;
printf("Enter enter any number : ");
scanf("%d",&num);
rsl = fact(5);
printf("Factorial of %d is %d", num, rsl);
return 0;
//itvoyagers.in
}
Output :
Enter enter any number : 5
Factorial of 5 is 120
CHECKOUT OTHER RELATED TOPICS
CHECKOUT OTHER QUIZZES
Quizzes on Operator |
Easy Quiz on Operators in C part 1 |
Easy quiz on operators in C part 2 |
Easy quiz on operators in C part 3 |
Quizzes on Loops |
Easy quiz on loops in C part 1 |
Easy quiz on loops in C part 2 |
Easy quiz on loops in C part 3 |
Quizzes on Decision Making Statement |
Easy Quiz On Decision Making Statements Part 1 |
Easy Quiz On Decision Making Statements Part 2 |
Quizzes on String |
Easy quiz on String in C programming part 1 |
Quizzes on Array |
Easy quiz on Array in C programming – part 1 |
5 – Best Java program to convert decimal to binary |
New Quizzes Coming soon.. |
PRACTICALS IN C PROGRAM
We are aiming to explain all concepts of C in easiest terms as possible.

ITVoyagers
Author