C Program to Calculate the Factorial by Using Recursion

0
1
digitalample eye
Write a program to calculate the factorial of entered number.
Write a C program to calculate the factorial of entered number using recursion.
C Program to calculate the factorial of number using function.
C Program to Calculate Factorial of the Value.

C Code

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
int factorial(int);
printf("Enter a number:");
scanf("The factorial of %d is %d", n,factorial(n));
getch();
}
int factorial(int n)
{
if(n<1)
return(1);
else
return(n*factorial(n-1));
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here