how to display doubles with trailing zeros in c#

126

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));

Comments

Submit
0 Comments