C Program to find the factorial of the entered number using recursive function

0
9
digitalample eye

Write a program to find the factorial of entered number by using recursive function.

Write a c program to take input from user and find the factorial of the entered number by using recursive function.

C Code

#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

LEAVE A REPLY

Please enter your comment!
Please enter your name here