public void TestMethod1() { var numberOne = new BigNumber("925"); var numberTwo = new BigNumber("125"); var result = Program.Multiply(numberOne, numberTwo); Assert.AreEqual("115625", result.Number); }
public static BigNumber Multiply(BigNumber one, BigNumber two) { var numberOneSize = one.SequenceOfNumbers.Count; var numberTwoSize = two.SequenceOfNumbers.Count; var results = new List<string>(); for (int i = numberTwoSize -1; i >= 0; i--) { var result = ""; result = AddNulls(result, HowManyNullsToAdd(numberTwoSize, i)); var remainder = 0; for (int j = numberOneSize-1; j >= 0; j--) { int multiply = Multiply(two.SequenceOfNumbers[i], one.SequenceOfNumbers[j]); multiply = AddRemainder(multiply, remainder); var numberToWrite = GetNumberToWrite(j, multiply); remainder = GetRemainder(j, multiply); result = PrependToResult(result, numberToWrite.ToString()); } AddCurrentResultToResults(result, results); ClearResult(result); } return null; }