factorial program using recursion in C:
long fact(int n)
{
    if (n == 1)
       return 1;
    else
    {
       return n*fact(n - 1);
    }
}
The program works perfectly for numbers up to 12. But for numbers bigger than that the fact gives a wrong value.
The range of long is sufficient for such numbers then what is the reason that factorial is not getting calculated for the numbers greater than 12?
 
     
     
    