Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I wonder, how do I calculate factorial of 10,000?

(acaba 10000 faktöryeli nasıl hesaplarım)
Posted
Updated 3-Apr-13 0:51am
v4
Comments
[no name] 2-Apr-13 20:33pm    
That is not even a complete sentence. And the is an English speaking site. You would either need to ask your question in English including the code that you have tried, with a description of your problem. Or, you might be more comfortable finding a Turkish speaking site to ask your question.
Can GARİP 2-Apr-13 20:37pm    
ThePhantomUpVoter , ill take it from here :)
Can GARİP 2-Apr-13 20:35pm    
PDP ?
nika2008 3-Apr-13 6:52am    
is this homework?
Can GARİP 3-Apr-13 10:14am    
should be

Once again, Google answers the question.

Factorial Calculator[^]

Factorial Program using C#[^]
 
Share this answer
 
Using the BigInteger[^] Structure you might accomplish the task.

Namely (you should have a big big big console.... :-) ):
C#
class Program
{
  public static BigInteger fact(Int32 n)
  {
    BigInteger f = new BigInteger(n);
    while (--n > 1)
    {
      f *= n;
    }
    return f;
  }

  static void Main(string[] args)
  {
    BigInteger f = fact(10000);
    Console.WriteLine(f.ToString());
  }
}
 
Share this answer
 
v3
Just to mention it for completeness, you could use the Gamma function[^] to calculate the factorial. But with such a large number youll have to use the BigInteger class anyway.

The gamma function is implemented here:
Sound in games - Acoustical leaks in walls[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900