Table of Contents
C program to find factorial using recursion
Factorial is multiplying number by every number below it till 1.
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.
C program to find factorial of a number using recursion
#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
PRACTICALS/PRACTICE PROGRAM IN C
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.. |
We are aiming to explain all concepts of C in easiest terms as possible.

ITVoyagers
Author