How to format Decimal number into a string in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Decimal d = 27.89m;

            string sf = String.Format("{0}", d);
            Console.WriteLine(sf);
        }
    }
}


/*
run:
     
27.89
 
*/

 



answered Dec 23, 2016 by avibootz

Related questions

1 answer 158 views
1 answer 179 views
1 answer 126 views
4 answers 214 views
214 views asked Apr 5, 2022 by avibootz
...