Feii Momo
Feii Momo

Reputation: 13

Showing the amount that has been rounded off instead of only the after-round off value c#

im sorry if it will be confusing as the title speaks, but i will explain in details of what i need. sorry for troubling as i am still a newbie in c#. here, lets say:

decimal value = 40.23;
decimal total = Math.Round(value * 20.0m, 0) / 20.0m;
roundingbox.Text = total.ToString("f2");

the output given will be 40.25 without fail. However, im not sure if it is possible to do something like this, e.g: round off amount

please let me know as i have been stuck here for quite some time in my progress to create a pos system. Thanks a lot.

Upvotes: 0

Views: 63

Answers (1)

AdricoM
AdricoM

Reputation: 579

decimal difference = value - total; should give you what you want, no?

Upvotes: 3

Related Questions