The Fixed-Point Numeric Formatting string returns the integer and the decimal digits with the negative symbol (if provided). The Fixed-Point Numeric formatting staring also accepts the precision specifier which indicates the number of decimal digits .
Fixed-Point Numeric Formatting in C#
Below is a sample sourecode demonstrating the Fixed-Point Numeric formatting using the Numeric Format String “F” and “F4”.
using System; namespace ConsoleApplication1 { internal class Program { // Fixed-Point Numeric Formatting in C# private static void Main(string[] args) { float input = 765.56F; Console.WriteLine("{0:F}", input); Console.WriteLine("{0:F5}", input); Console.ReadLine(); } } }
Leave a Reply