Logarithm tricks for Competitive Programming | C ++ implementation count the number of digits in a number ; Function to count the number of digits in a number ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int countDigit ( long long n ) { return floor ( log10 ( n ) + 1 ) ; } int main ( ) { double N = 80 ; cout << countDigit ( N ) ; return 0 ; }