public void TestMethod4() { Calculate c = new Calculate(); BigInteger result = c.CalculateFactorial(100); result.ToString(); }
static void Main(string[] args) { Calculate c = new Calculate(); BigInteger result = c.CalculateFactorial(100); double sum = 0; char[] array = result.ToString().ToArray<char>(); foreach (char number in array) { sum += Char.GetNumericValue(number); } Console.WriteLine(sum); Console.ReadLine(); }
static void Main(string[] args) { var same = new List<int>(); Calculate c = new Calculate(); for (int i = 11; i < 100000; i++) { var numbers = ConvertToIntArray(i); int sum = numbers.Sum(n => (int) c.CalculateFactorial(n)); if (i == sum) { same.Add(i); } } foreach (var s in same) { Console.WriteLine(s); } Console.ReadLine(); }
public void CalculateFactorial_20() { Calculate c = new Calculate(); var result = c.CalculateFactorial(20); Assert.That(new BigInteger((ulong)2432902008176640000), Is.EqualTo(result)); }
public void CalculateFactorial_9() { Calculate c = new Calculate(); var result = c.CalculateFactorial(9); Assert.That(new BigInteger(362880), Is.EqualTo(result)); }
public void TestMethod3() { Calculate c = new Calculate(); var result = c.CalculateFactorial(20); Assert.AreEqual(new BigInteger((ulong)2432902008176640000), result); }
public void TestMethod2() { Calculate c = new Calculate(); var result = c.CalculateFactorial(10); Assert.AreEqual(3628800, result); }
public void TestMethod1() { Calculate c = new Calculate(); var result = c.CalculateFactorial(3); Assert.AreEqual(6, result); }