Last active
July 18, 2019 07:22
-
-
Save thecoducer/c80cb1e58a22eb60405d5be6d2d2cb13 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
// Since the result can be large | |
// long long is used as return type | |
long long countdigits(int n){ | |
if(n <= 1) | |
return n; | |
else{ | |
double x = ((n * log10(n / M_E)) + (log10(2 * M_PI * n) / 2.0)); | |
return floor(x) + 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment