Hints on Extracting Digits

Compiled By Unknown - No Comments
Hints: Use n % 10 to extract a digit; and n = n / 10 to discard the last digit.
int n = ....;
while (n > 0) {
   int digit = n % 10;  // Extract the last digit
   ......
   .....
   n = n / 10;          // Drop last digit and repeat the loop
}

Tags:

No Comment to " Hints on Extracting Digits "