C Program to find factorial of input number using Recursion

#include<stdio.h>
#include<conio.h>
int fact(int);
int main()
{
 int x,y;
 clrscr();
printf("Enter Number to find Factorial:- ");
scanf("%d",&x);
 y=fact(x);
 printf("Factorial of number = %d",y);
 getch();
}
int fact(int f)
{
 int g;
 if(f==1)
 {
  return (1);
  }
  else
  {
 g=f*fact(f-1);
}
}

OUTPUT:-

factorial

Leave a Reply

Your email address will not be published. Required fields are marked *