Skip to content

Instantly share code, notes, and snippets.

@sergiosvieira
Created February 20, 2021 22:14
Show Gist options
  • Save sergiosvieira/f397f996e92141d0f09328d915a878b1 to your computer and use it in GitHub Desktop.
Save sergiosvieira/f397f996e92141d0f09328d915a878b1 to your computer and use it in GitHub Desktop.
Count digits of an integer
int n = 123456;
std::cout << (int)log10(n) + 1 << "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment