C Program to find the factorial of the 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

TutsMaster.org

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