Factorial of a number is a very commonly used function and so, not surprisingly programmers run in to this quite often. But, there is no direct function we can call to do this for us. So, each time i have to use this, i end up writing a 5-10 line code using recursion or some other method and then call that for the factorial, which is pretty boring.

But, I have found a very easy way to implement factorial with a built-in function of "

*math.h*" called

**So, lets see how to implement this program**

*tgamma().*#include <math.h> #include <stdio.h> double fact(double x) { return tgamma(x+1); } int main() {