C Program find the Factorial of the given number using Recursion

      It is a technique that makes a method calls itself repeatedly until some base condition is satisfied.

for more on recursion, Visit:

Source Code:
  Program to find a factorial of number using recursion   
  Author: sourcecodesonline.blogspot.com
int factorial(int);  
int main(void)
  int no,i,fact;  
  printf("\nEnter the number: ");  
  fact=factorial(no); //function to return the factorial the parameter passed  
  printf("\nThe factorial of number %d is %d\n",no,fact);  
 return 1;  
//recursive function to find factorial of a number  
int factorial(int n)  
  if(n==0)//base condition  
    return 1;  
     return n * factorial(n-1);   
    Next Post »

    If you still didn't find what you're looking for, you can search this website below: