int digitDegree(int n) { int i = 0; while (n >= 10) { n = sumdig(n); i++; } return i; } int sumdig(int n) { int r = 0; while (n != 0) { r += n % 10; n /= 10; } return r; }