# Write a program in c to print factorial using recursion

One of its advantages is that when we need to make changes to code then instead of changing the complete code, we can just modify the function concerned. The inner function again call itself etc. It calls int factorial int n method to find the factorial value. C program to find the factorial of a number using recursion Published by admin on December 11, C program to find factorial of a number using recursion : In this tutorial, we will learn how to find the factorial of a number in c programming language using recursion.

This function takes one int as input and returns one integer. In the for loop, the value of factorial is multiplied with each integer and stored successively till the input number is reached. The solution to the base condition is provided while the solution to the larger value can be solved by converting to smaller values till the base solution is reached and used.

Factorial Using Functions This approach is known as a modular approach and should be followed for programming as it is quite efficient. For factorial of any other number the process involves one comparison, one multiplication, one subtraction, and one function call. Finally, print out the result. If the integer entered is negative then appropriate message is displayed.

It will be more meaningful if I will explain you with an example. Now calculate the factorial. Factorial Using Recursion Recursion is the process in which a function calls itself and the corresponding function is called recursive function.

Rated 10/10 based on 106 review