General Numeric Formatting in C#

Below is a sample source code demonstrating General Numeric Formatting(G) string in C# .

using System;

namespace ConsoleApplication1

{

internal class Program

{

// General Numeric Formatting in C#

private static void Main(string[] args)

{

float input = 107.7899F;

Console.WriteLine("{0:G}", input);

Console.WriteLine("{0:G10}", input);

Console.ReadLine();

}

}

}
General Numeric Formatting in C#