• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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