Answer:
The program in Python is as follows:
cents = int(input("Cent: "))
quarter = int(cents/25)
if quarter > 1:
print(str(quarter)+" quarters")
elif quarter == 1:
print(str(quarter)+" quarter")
cents = cents - quarter * 25
dime = int(cents/10)
if dime>1:
print(str(dime)+" dimes")
elif dime == 1:
print(str(dime)+" dime")
cents = cents - dime * 10
nickel = int(cents/5)
if nickel > 1:
print(str(nickel)+" nickels")
elif nickel == 1:
print(str(nickel)+" nickel")
penny = cents - nickel * 5
if penny > 1:
print(str(penny)+" pennies")
elif penny == 1:
print(str(penny)+" penny")
Step-by-step explanation:
This line prompts user for input in cents
cents = int(input("Cent: "))
This line calculates the number of quarters in the input amount
quarter = int(cents/25)
This following if statement prints the calculated quarters
if quarter > 1:
print(str(quarter)+" quarters")
elif quarter == 1:
print(str(quarter)+" quarter")
cents = cents - quarter * 25
This line calculates the number of dime in the input amount
dime = int(cents/10)
This following if statement prints the calculated dime
if dime>1:
print(str(dime)+" dimes")
elif dime == 1:
print(str(dime)+" dime")
cents = cents - dime * 10
This line calculates the number of nickels in the input amount
nickel = int(cents/5)
This following if statement prints the calculated nickels
if nickel > 1:
print(str(nickel)+" nickels")
elif nickel == 1:
print(str(nickel)+" nickel")
This line calculates the number of pennies in the input amount
penny = cents - nickel * 5
This following if statement prints the calculated pennies
if penny > 1:
print(str(penny)+" pennies")
elif penny == 1:
print(str(penny)+" penny")