This program will help you to control number of decimal points after decimal using C#. use F and then Number of decimal points.
C# Example to control decimal point
using System;
using System.Globalization;
namespace MyApp
{
class decimal_formatting_class
{
static void Main()
{
double myAmount = 105.245;
Console.WriteLine(myAmount.ToString("F2", CultureInfo.InvariantCulture));
Console.WriteLine(myAmount.ToString("F4", CultureInfo.InvariantCulture));
Console.Read();
}
}
}
No comments:
Post a Comment