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.
jazzcatoneAsked:
Who is Participating?
 
Jens FiedererConnect With a Mentor Test Developer/ValidatorCommented:
You should to use Math.Truncate for this
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You could also just use INTEGER DIVISION like this:

    int numoftwenties = (int)change / (int)20;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.