SyntaxFix
Write A Post
Hire A Developer
Questions
An obvious, but slow, mathematical approach is:
int firstDigit = (int)(i / Math.Pow(10, (int)Math.Log10(i))));