Link to home
Start Free TrialLog in
Avatar of Jason Livengood
Jason LivengoodFlag for United States of America

asked on

Trying to round a quotient down

I am dividing two decimals. I need the quotient to always round down.Also, the resulting quotient should  be a whole number integer. Currently I can make the quotient round to the nearest whole number (int numoftwenties = (int)Math.Round((decimal)change /20.00m);, but I need it round down. I am trying to calculate the number of twenty dollar bills that would be given back as change to a customer.

For example if a customer was to receive 95.00 dollars in change back. They would receive 4  (not 5)twenty dollar bills back.
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Tomlinson
You could also just use INTEGER DIVISION like this:

    int numoftwenties = (int)change / (int)20;