Created
September 1, 2017 22:26
-
-
Save samcv/77c241e6d25c035213ea6230c6011a01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static size_t length_of_num (size_t number) { | |
if (number < 10) return 1; | |
if (number < 100) return 2; | |
if (number < 1000) return 3; | |
return 1 + length_of_num(number / 10); | |
} | |
static size_t length_of_num (size_t number) { | |
if (number < 10) return 1; | |
return 1 + length_of_num(number / 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment