using System;
class Sample
{
public static void Main()
{
Console.WriteLine("(P) Percent:. . . . . . . . . {1:P}
" + -123, -123.45f);
}
}
Round trip float point value
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("(R) Round-trip: . . . . . . . {1:R}
" + -123, -123.45f);
}
}
Output float point as Hexadecimal
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("(X) Hexadecimal:. . . . . . . {0:X}
" + -123, -123.45f);
}
}
Use general format to output a float point value
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("(G) General:. . . . . . . . . {0:G}
" + + -123, -123.45f);
}
}
Format float point value as fixed point
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("(F) Fixed point:. . . . . . . {1:F}
" + -123, -123.45f);
}
}
Format float number as scientific notation
Output float number as currency
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("(C) Currency: . . . . . . . . {0:C}
" + -123, -123.45f);
}
}

