Possible Duplicate:
How to format a decimal
How can I limit my decimal number so I'll get only 3 digits after the point?
e.g 2.774
Now you can limit the decimal places. Select the cell with a number (here, B2) and in the Menu, go to Format > Number > More Formats > Custom number format.
Select the cells that you want to format. On the Home tab, click Increase Decimal or Decrease Decimal to show more or fewer digits after the decimal point.
Math.Round Method (Decimal, Int32)
Example:
Math.Round(3.44, 1); //Returns 3.4.
I'm assuming you really mean formatting it for output:
Console.WriteLine("{0:0.###}", value);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With