Create a Python program that calculates the exact amount of change to give a customer in denominations of
quarters, dimes, nickels, and pennies. For example, if the change is 79 cents, how many of each coin would be
needed to give change? Include the necessary code and code descriptions.
I have a tried to solve it, here’s my code:
amount=int(input)()
num_quarters= int(amount/25)
amount= amount%25
num_dimes=int(amount/10)
amount=amount%10
num_nickels=int(amount/5)
amount=amount%5
num_pennies=int(amount/1)
amount=amount%1
print(” Number of coins of quarters :”, num_quarters)
print(” Number of coins of dimes :”, num_dimes)
print(” Number of coins of quarters :”, num_nickels)
print(” Number of coins of pennies :”, num_pennies)
I need to explain what’s wrong with the code & correct it.
*Need correct code, that if complied will work

Sample Solution

This question has been answered.

Get Answer