Skip to content

Instantly share code, notes, and snippets.

@buvinghausen
Created May 25, 2021 20:40
Show Gist options
  • Save buvinghausen/066d2d6c325acc71019bd3aebe1806e0 to your computer and use it in GitHub Desktop.
Save buvinghausen/066d2d6c325acc71019bd3aebe1806e0 to your computer and use it in GitHub Desktop.
using System.Linq;
int digitDegree(int n)
{
var str = n.ToString();
var i = 0;
for (; str.Length > 1; i++)
{
str = str.Sum(c => int.Parse(c.ToString())).ToString();
}
return i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment