Skip to content

Instantly share code, notes, and snippets.

@sarpeedo
Created February 10, 2017 21:47
Show Gist options
  • Save sarpeedo/e12fe23db8273e19adb3a8a3b5087e19 to your computer and use it in GitHub Desktop.
Save sarpeedo/e12fe23db8273e19adb3a8a3b5087e19 to your computer and use it in GitHub Desktop.
int q = 22222; // lots of digit number
while (q > 9) {
digit = q % 10; // do something useful here with the digit
q = q/10; // so in the first pass 22222 -> 2222 (remember division truncates does not round)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment