static public int DigitalRoot(int input) { int res = (int)input.ToString().ToList().ConvertAll(el => char.GetNumericValue(el)).Sum(); return(res.ToString().Length < 2 ? res : Task3.DigitalRoot(res)); }
public void DigitalRootTest(int input, int output) { var res = Task3.DigitalRoot(input); Assert.AreEqual(res, output); }
public void DigitalRootTest(int input, int output) { var InpNum = Task3.DigitalRoot(input); Assert.AreEqual(InpNum, output); }