Factorial using recursion in c code is mostly used in calculating permutation and combination. As we can see how c program for combination and c program for permutation is implemented. Factorial sign is ‘!’ i.e exclamatory mark.

For eg 4! can be calculated as : 4!=4*3*2*1=24.

## Factorial using recursion in c code

#include<stdio.h> #include<conio.h> int recfact(int); main( ) { int a, fact, rec ; printf ( "\nEnter any number " ) ; scanf ( "%d", &a ) ; rec = recfact ( a ) ; printf ( "Factorial value = %d", fact ) ; getch(); } int recfact( int x ) { int f ; if ( x == 1 ) return ( 1 ) ; else f = x * recfact ( x - 1 ) ; return ( f ) ; }

### Output:

Factorial using recursion in c code |