[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

C#: Rounding decimal numbers

Posted on 2012-03-18
5
Medium Priority
?
505 Views
Last Modified: 2012-05-18
Calculation results have to be rounded up to the nearest 0.05

thanks
0
Comment
Question by:quasar_ee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Assisted Solution

by:a_b
a_b earned 1000 total points
ID: 37736259
0
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 1000 total points
ID: 37736362
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 0 total points
ID: 37736557
var result = 105.06;
result = Math.Round(Math.Round(result/0.05, 0)*0.05, 2);

Open in new window

0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 37737232
Below method could be used.

Decimal.Round(YourValue, 2),
0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 37737238
String round = YourValue.ToString("#0.00");
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question