no of digits in a number c++ code example
Example: count digits c++
template <class T>
T countDigits(T number)
{
return T(log10(number) + 1);
}
//If the number is very large, use string
template <class T>
T countDigits(T number)
{
return T(log10(number) + 1);
}
//If the number is very large, use string