Recursive Digit Sum

  • + 0 comments

    c# solution with recursion :

    if(n.Length == 1){
    	return int.Parse(n);
    }
    
    //Loop trough the digits and multiply by k, the convert to string again
    n = (n.Sum(c => char.GetNumericValue(c))*k).ToString();
    return superDigit(n,1);