makeChange(amount,denomination)
Version 1.0.0.0 (3.56 KB) by
Toby
Determines combinations of integers (denominations) which sum to a specified integer amount
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 (2026). 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 LinuxCategories
Find more on Data Type Conversion in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
