Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Do I Round up the Total Value Like

if The Number is 16.136
it should look like 16.140 and
if the number is 16.132
it should look like 16.130
Posted

1 solution

Use Math.Round[^]
C#
decimal d = 16.136M;
Console.WriteLine(Math.Round(d, 2));    // 16.14
d = 16.132M;
Console.WriteLine(Math.Round(d, 2));    // 16.13
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900