Calculating User Values c#

Elementary school arithmetic returns the correct result.

Tuple<int, decimal> calculate(decimal money, decimal price)
{
    int buy = (int)Math.Floor(money / price);
    decimal left = money - buy * price;
    return new Tuple<int, decimal>(buy, left);
}

Leave a Comment