How to count of the total number of digits in a number in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = 9987262153;

            Console.WriteLine("The total number of digits is: {0}", n.ToString().Length);
        }
    }
}
/*
run:

The total number of digits is: 10

*/



answered Sep 19, 2014 by avibootz

Related questions

2 answers 165 views
2 answers 157 views
1 answer 238 views
2 answers 181 views
1 answer 133 views
...