Math.Floor(Math.Log10(n) + 1);
//find how much digit in number
//decimal point will not be added
static int digitCountOf(int number){
return number.ToString().Length;
}
//recursion
//input: 123
//output: 3 :)
static int CountDigits(int num, int count)
{
if (num == 0)
{
return count;
}
return CountDigits(num / 10, ++count);
}
static void Main(string[] args)
{
Console.WriteLine(CountDigits(123, 0));
}