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 156 views
2 answers 152 views
1 answer 230 views
2 answers 175 views
1 answer 126 views
...