Set the number of decimal places

Madhu.b.rokkam
Posted by Madhu.b.rokkam under C# category on | Points: 40 | Views : 2287
double yourNumber = 125.5489;
Console.WriteLine(yourNumber.ToString("F3", CultureInfo.InvariantCulture));


result
125.549

double yourNumber = 125.5489;
Console.WriteLine(yourNumber.ToString("F2", CultureInfo.InvariantCulture));


result
125.55

Comments or Responses

Login to post response