public void SumOfDigits() { var number = BigInteger.Pow(2, 1000).ToString(); var sum = NumberHelpers.GetSumOfDigits(number); Assert.AreEqual(1366, sum); }
public void GetSumOfDigitsTest2() { var number = "1234"; var sum = NumberHelpers.GetSumOfDigits(number); Assert.AreEqual(10, sum); }
public void MainTest() { BigInteger a = 1; for (var i = 2; i <= 100; i++) { a = BigInteger.Multiply(a, i); } Assert.AreEqual(648, NumberHelpers.GetSumOfDigits(a.ToString())); }