• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

C#: Rounding decimal numbers

Calculation results have to be rounded up to the nearest 0.05

thanks
0
quasar_ee
Asked:
quasar_ee
3 Solutions
 
BuggyCoderCommented:
var result = 105.06;
result = Math.Round(Math.Round(result/0.05, 0)*0.05, 2);

Open in new window

0
 
Easwaran ParamasivamCommented:
Below method could be used.

Decimal.Round(YourValue, 2),
0
 
Easwaran ParamasivamCommented:
String round = YourValue.ToString("#0.00");
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now