-1

I need to round up value like 0.15, 0.20, 0.25 to nearest whole number 1. I'm trying like below but it is returning 0.

decimal fees = Math.Round(30 * 0.005M);

I would appreciate any help or suggestion on the above.

user7336033
  • 271
  • 3
  • 16

3 Answers3

2

try this

 decimal fees = Math.ceil(30 * 0.005M);
1

You can use Math.Ceiling

decimal fees = Math.Ceiling(30 * 0.005M);
lucky
  • 12,734
  • 4
  • 24
  • 46
1

You should have a look at Math.Ceiling. Also you should search your query before asking a question and you would have found:

Decimal/double to integer - round up (not just to nearest)

Mahan.A
  • 79
  • 1
  • 7