This preview shows page 1. Sign up to view the full content.
Unformatted text preview: money = round(money*100)/100; %code given to fix Matlab few = 0; %initialize count at 0 if money==0 %terminating condition, because it is when there is no money left few = 0; %few will be 0 because no money is left elseif money>=1 %checks to account for all of the dollar bills first, because it is the %largest amount of money few = 1 + makeChange(money-1); %adds one to the recursively called makeChange and subtracts the dollar %found in the money elseif mod(money,.25)==0 %checks to account for all of the quarters few = 1 + makeChange(money-.25); elseif mod(money,.10)==0 few = 1 + makeChange(money-.10); elseif mod(money,.05)==0 few = 1 + makeChange(money-.05); elseif mod(money,.01)==0 few = 1 + makeChange(money-.01); end end...
View Full Document
- Spring '08