# Thread: MatLab- Find least number of coins using REM and FIX functions

1. ## MatLab- Find least number of coins using REM and FIX functions

I have a matrix from 1 to 99 called ChangeDue. It represents change from 1 cent to 99 cents. I want to compute the number of quarters, dimes, nickels, and pennies that will equal the Change Due using the least number of coins.

I want to use the FIX and REM functions. If i do fix(ChangeDue/25) i will get a matrix of the number of quarters that can be used up to 99 cents. Similarly, fix(ChangeDue/1) will give me the number of pennies that can be used.

So I can I combine finding pennies, nickels, dimes and quarters into one process to give me least number of coins possible?

2. Originally Posted by stimulisrk I have a matrix from 1 to 99 called ChangeDue. It represents change from 1 cent to 99 cents. I want to compute the number of quarters, dimes, nickels, and pennies that will equal the Change Due using the least number of coins.

I want to use the FIX and REM functions. If i do fix(ChangeDue/25) i will get a matrix of the number of quarters that can be used up to 99 cents. Similarly, fix(ChangeDue/1) will give me the number of pennies that can be used.

So I can I combine finding pennies, nickels, dimes and quarters into one process to give me least number of coins possible?
Use the greedy algorithm. Also look at the wording of this; it is not clear what this ChangeDue matrix is or contains.

CB

#### Search Tags

coins, fix, functions, matlab, matlab coins math fix rem, number, rem 