General Numeric Formatting in C#


This content was proof-read by Grammarly. You can Try Grammary for FREE

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#
%d bloggers like this: