makeChange(amount,d​enomination)

Version 1.0.0.0 (3.56 KB) by Toby
Determines combinations of integers (denominations) which sum to a specified integer amount
58 Downloads
Updated 29 Apr 2016

View License

Works recursively to determine the number of combinations (and optionally the combinations themselves) of sets of specified integers (denominations) that can be formed to sum to the input amount.
example:
To determine the number of possible ways to make change for a dollar using pennies, nickels, dimes, and quarters; one would call:
[nCombinations, combinations] = makeChange(100,[1,5,10,25]);

Cite As

Toby (2024). makeChange(amount,denomination) (https://www.mathworks.com/matlabcentral/fileexchange/56834-makechange-amount-denomination), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Type Conversion in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0