← Back

Code Challenge 7 - Change Calculator


When a cashier performs transactions at a register, they quickly learn how to give back change efficiently. You start with the largest coin denomination and work your way down until you have exact change. For example, if the cahsier needs to give back 55 cents, they would take out two quarters and one nickel. You could technically give back 55 pennies, 5 dimes and a nickel, or some other change combination, but it’s arguably less efficient.

This change calculator would help novice cashiers give back the correct change starting with the largest denomination to the smallest.

Skills to Practice

Challenge Tasks

  1. Create a console project named CodeChallenge7ChangeCalculator.
  2. Complete the folowing tasks:
    1. Prompt the user to enter how much change to give back. The value should be between 1-99.
    2. Calculate the correct number for each coin denomination: quarters, dimes, nickels, and pennies.
    3. Output the number of each coin denomination to give back.

Sample Output