Rounding Down to the Nearest Decimal Point in C-Sharp (AspNet 6)


Question: How do you Round Down the number to the nearest decimal point in C#? the number I want to round down is 0.7777777777777777771, when I round use
Math.Round(MyNumber,02) the answer is 0.78. I don't want this answer, I wanted 0.77.

How do you do that with Math.Round() Method?


Login to See the Rest of the Answer

Answer:
See the code below:

decimal myRoundDownValue = Math.Round(MyNumber,2,MidpointRounding.ToNegativeInfinity);
//                                



Hy said:

If you want to get a positive number from a subtraction in C sharp just use Decimals and absolute values.

Posted On: March 02, 2022 13:30:03 PM


For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]