C Program to Calculate Factorial of a number using Recursion Function


#include
main()
{
int a, fact;
printf("\nEnter any number: ");
scanf ("%d", &a);
fact=rec (a);
printf("\nFactorial Value = %d", fact);
}
rec (int x)
{
int f;
if (x==1)
return (1);
else
f=x*rec(x-1);
return (f);
}

4 comments:

  1. IT'S NOT CLEAR ENOUGH COMPARE TO WHAT BASIC EXPLAIN THIS IS TOO COMPREHENSIVE FOR BEGINNER

    ReplyDelete
  2. program by using while and recursion for finding factorial of enter number

    ReplyDelete