Akshay J Akshay J - 1 year ago 101
C# Question

Rounding Decimal Indian Rupees C#

I want to round off one decimal variable (ex Rs. 5.65) with 2 rules:

  1. if the part after decimal (.65 in
    the example) in greater that 49, add
    1 to the part before decimal.(Make
    it 6)

  2. If the part after decimal is less
    that 49(ex: 2.45) remove the part
    after decimal(Ex: Make it 2.00)

Please suggest a solution.

EDIT Can anyone tell me how to achieve the same using TSQL and CrystalReport ???

Answer Source

Look at Math.Round(decimal, MidPointRounding), it should do what you need.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download