Answers for ".write a c program to find factorial using recursion."

C
0

factorial in c using recursion

/* Program Name: Find Factorial
 */
#include<stdio.h>
int find_factorial(int);
int main()
{
   int num, fact;
   //Ask user for the input and store it in num
   printf("\nEnter any integer number:");
   scanf("%d",&num);
 
   //Calling our user defined function
   fact =find_factorial(num);
 
   //Displaying factorial of input number
   printf("\nfactorial of %d is: %d",num, fact);
   return 0;
}
int find_factorial(int n)
{
   //Factorial of 0 is 1 
   if(n==0)
      return(1);
 
   //Function calling itself: recursion
   return(n*find_factorial(n-1));
}
Posted by: Guest on March-12-2022

Code answers related to ".write a c program to find factorial using recursion."

Code answers related to "C"

Browse Popular Code Answers by Language