SyntaxFix
Write A Post
Hire A Developer
Questions
Almost certainly more efficient than using Strings:
int firstDigit(int x) { while (x > 9) { x /= 10; } return x; }
(Works only for nonnegative integers.)