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

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