Click here to Skip to main content
15,917,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I have salaries table in my project in c# and want to Round the net salary
for example the net salary is 343.333 I want to Round it to 345
how can I solve that?
Posted
Comments
Suvendu Shekhar Giri 6-Jan-15 3:26am    
Why 345? and why not 343 or 344? any specific reason for that?

1 solution

Um. There is no standard method that will do that: rounding to "the nearest multiple of five" is not a standard maths operation.
But, it's not that complex:
C#
Math.Round(value / 5.0) * 5;
Should do it.
 
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