Trying to round a quotient down

Posted on 2008-11-12
Last Modified: 2012-05-05
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.
Question by:jazzcatone
    LVL 23

    Accepted Solution

    You should to use Math.Truncate for this
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    You could also just use INTEGER DIVISION like this:

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

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now