Format number : Number format : Data Type C# Examples


C# Examples » Data Type » Number format »

 

Format number









    
using  System;

class  MainClass
{
    public  static  void  Main(string[]  args)
    {
        Console.WriteLine("C  format:  {0:C}",  99989.987);
        Console.WriteLine("D9  format:  {0:D9}",  99999);
        Console.WriteLine("E  format:  {0:E}",  99999.76543);
        Console.WriteLine("F3  format:  {0:F3}",  99999.9999);
        Console.WriteLine("N  format:  {0:N}",  99999);
        Console.WriteLine("X  format:  {0:X}",  99999);
        Console.WriteLine("x  format:  {0:x}",  99999);

    }
}
    
   
  
   



Output

C format: $99,989.99
D9 format: 000099999
E format: 9.999977E+004
F3 format: 100000.000
N format: 99,999.00
X format: 1869F
x format: 1869f


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Number format