How to count the digits of a double value in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        double d = 9812347.9085;

        string dstr = d.ToString();

        int total_digits = dstr.Length - 1;

        Console.Write(total_digits);
    }
}




/*
run:


11

*/

 



answered Jan 31, 2024 by avibootz

Related questions

1 answer 105 views
1 answer 111 views
1 answer 124 views
1 answer 141 views
1 answer 121 views
...