how to display doubles with trailing zeros in c# code example
Example 1: how to display doubles with trailing zeros in c#
string result = num.ToString("F" + numDigitsAfterPoint);
Example 2: how to display doubles with trailing zeros in c#
int numDigitsAfterPoint = 5;
double num = 1.25d;
string result = num.ToString("0." + new string('0', numDigitsAfterPoint));