C Program to Find Factorial of a Number Using Recursion

 

#include<stdio.h>
#include<conio.h>
void main()
{
int fact(int p);
int n, r, cr;
clrscr();
printf("Enter values of n and r :");
scanf("%d%d",&n,&r);
cr=fact(n)/(fact(r)*fact(n-r));
printf("Value of Cr is : %d",cr);
getch();
}
int fact(int p);
{
if(p==1)
return;
else
return(p*fact(p-1));
}

Output:

C Program to Find Factorial of a Number Using Recursion