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.
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
int fact(int x)
if(x != 0)
return x * fact(x-1);
printf("Enter enter any number : ");
rsl = fact(5);
printf("Factorial of %d is %d", num, rsl);
Enter enter any number : 5
Factorial of 5 is 120
Connect with us on following platforms
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..|