I have a number like this: int num = 36729; and I want to get the number of digits that compose the number (in this case 5 digits).
int num = 36729;
How can I do this?>
int digits = 0; while (num > 0) { ++digits; num = num / 10; }