About us

C Program for finding the Factorial of a number using recursion


C Program for finding the Factorial of a number using recursion

c-program-finding-factorial-using-recursion


#include<stdio.h>
#include<conio.h>
long int fact(int n);

void main()
{
 int num;

 clrscr();
 printf("Enter any number for find its Fatctorial\n");
 scanf("%d",&num);
 printf("Factorial of %d is %ld",num,fact(num));
 getch();
}

long int fact(int n)
{
 if(n==1)
  return 1;
 else
  return(n*fact(n-1));
}



OUTPUT

c-program-finding-factorial-using-recursion


------------------------------------------------------------------------------------------------------------

You can also visit:-