Why this Factorial function returning zero for large numbers
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1384160/calculating-factorial-of-large-numbers-in-c">Calculating factorial of large numbers in C</a>  </p>
</blockquote>



<p>Firstly, I am new to C++. I have tried below program to calculate factorial of any number.  </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
unsigned long factorial(unsigned long n){
   return n &lt;= 1 ? 1 : n * factorial(n-1);
}

int main()
{
  cout &lt;&lt; "Enter any Number to calculate factorial." &lt;&lt;endl;
  unsigned long n;
  cin &gt;&gt; n ;
  cout &lt;&lt; factorial(n)    ;
}
</code></pre>

<p>If i give small numbers like 5,3,20 it returns me exact value. But if I give numbers like 34 etc.. It is returning me zero. I assume that it is exceeding the limit range. Please help me on this to return exact result whatever the number I enter.</p>
