Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- class NfactorialMethod
- {
- static BigInteger Factorial(int n)
- {
- BigInteger nFactorial = 1;
- for (int i = 1; i <= n; i++)
- {
- nFactorial*=i;
- }
- return nFactorial;
- }
- static void Main()
- {
- int n=100;
- // ******************** The rezult of 100! *********************************
- BigInteger nf = Factorial(n);
- Console.WriteLine("{0}! = {1:N}", n, nf);
- }
- }
- /* static int NfactTrailZeros(int n)
- {
- int primeDiv5 = 5;
- int maxDivider = 5;
- int count = 0;
- while (maxDivider <= n)
- {
- count += n / maxDivider;
- maxDivider *= primeDiv5;
- }
- return count;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment