Esempio n. 1
0
        public void TestMethod4()
        {
            Calculate c = new Calculate();
            BigInteger result = c.CalculateFactorial(100);
            result.ToString();

        }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
 public void CalculateFactorial_20()
 {
     Calculate c = new Calculate();
     var result = c.CalculateFactorial(20);
     Assert.That(new BigInteger((ulong)2432902008176640000), Is.EqualTo(result));
 }
Esempio n. 5
0
 public void CalculateFactorial_9()
 {
     Calculate c = new Calculate();
     var result = c.CalculateFactorial(9);
     Assert.That(new BigInteger(362880), Is.EqualTo(result));
 }
Esempio n. 6
0
 public void TestMethod3()
 {
     Calculate c = new Calculate();
     var result = c.CalculateFactorial(20);
     Assert.AreEqual(new BigInteger((ulong)2432902008176640000), result);
 }
Esempio n. 7
0
 public void TestMethod2()
 {
     Calculate c = new Calculate();
     var result = c.CalculateFactorial(10);
     Assert.AreEqual(3628800, result);
 }
Esempio n. 8
0
 public void TestMethod1()
 {
     Calculate c = new Calculate();
     var result = c.CalculateFactorial(3);
     Assert.AreEqual(6, result);
 }