In this program, we are going to share a Give an example of a recursive function. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a Give an example of a recursive function with the output.
Copy the below C program and execute it with the help of Turbo C compiler. At the end of this program, We have shared the output of this program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include <stdio.h> int factorial(unsigned int); int main() { int i = 8; printf("Factorial of the number %d is %d\n", i, factorial(i)); return 0; } int factorial(unsigned int i) { if(i < 2) { return 1; } return i * factorial(i - 1); } |
Liked this program? Do Like & share with your friends.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: recursion in c programming pdf, recursive function c, recursive function example, recursive function example c, recursive function factorial, recursive function math, what is recursion in c explain with example