Logarithm tricks for Competitive Programming | Java implementation to count the number of digits in a number ; Function to count the number of digits in a number ; Driver Code
class GFG { static int countDigit ( double n ) { return ( ( int ) Math . floor ( Math . log10 ( n ) + 1 ) ) ; } public static void main ( String [ ] args ) { double N = 80 ; System . out . println ( countDigit ( N ) ) ; } }