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 164 views
1 answer 188 views
1 answer 137 views
4 answers 220 views
220 views asked Apr 5, 2022 by avibootz
...