How do I get what the digits of a number are in C++ without converting it to strings or character arrays?
The following prints the digits in order of ascending significance (i.e. units, then tens, etc.):
do { int digit = n % 10; putchar('0' + digit); n /= 10; } while (n > 0);