This program taking numbers from users and finding Factorial numbers using a recursive function in C
#include<stdio.h>
// recursive function to find factorial of a number
int fact(int num)
{
if(num>0)
return num*fact(num-1);
else
return 1;
}
int main()
{
int n, result;
printf("Enter a positive number: ");
scanf("%d",&n);
result= fact(n);
printf("factorial of number= %d",result);
return 0;
}
Enter a positive number: 5 factorial of number= 120