Programming

C – Find the Factorial of Entered Number using Recursive Function

This program explains how to find factorial of the entered number using recursive function.

#include <stdio.h>
#include <conio.h>
int factorial (int);
void main()
{
  int number;

  printf("enter a numbers :");
  scanf("%d",&number);

  printf("n the factorial of the entered number %d is : %d",number, factorial(number));

  getch();
}
int factorial(int number){
  if (number<=1)
    return(1);
  else
    return(number*factorial(number-1));
  }

Output

factorial recursive function

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.