Write a program to make change for a given amount using the modulus operator

As described in class (screencast), implement the “greedy making change” algorithm to determine the fewest number of quarters, dimes, nickels, and pennies needed to make change for a given number of pennies.

Use the modulus operator % to determine the amount left after dividing by an amount.

Hint: The modulus will always be less than the amount you are dividing out since it is the “remainder” or what’s left after dividing by the amount. For example, amount%25 will be a number between 0-24 because if it were larger there would be at least one 25 that could have divided into it. This automatically removes the “maximum” number of 25’s from $amount.

Suggestions:

If you get stuck, ask the TA or Instructor for the screencast solution.

Rx: <10 min Av: 15 min Sd: 20 min DNF: 20+ min