Find Factorial of Number Using Recursion

#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
 int x,n;
 printf("nEnter the value of n :");
 scanf("%d",&n);
 x=fact(n);
 printf("n%d",x);
 getch();
}
int fact(int n)
{
 if(n==0)
  return(1);
 return(n*fact(n-1));
}

Share this

Related Posts

Previous
Next Post »