How to convert double to percentage string in C#

1 Answer

0 votes
using System;

class Test
{
    static void Main() {
        double d = 0.872;
        
        string str = string.Format("{0:0.0%}", d);

        Console.WriteLine(str);
    }
}



 
/*
run:

87.2%
 
*

 



answered Oct 30, 2022 by avibootz

Related questions

1 answer 179 views
1 answer 210 views
1 answer 186 views
1 answer 259 views
2 answers 304 views
304 views asked Dec 23, 2016 by avibootz
...