代码拉取完成,页面将自动刷新
# Receive the amount
amount = eval(input("Enter an amount as integer, e.g., 1156 for 11 dollars 56 cents: "))
# Convert the amount to cents
remainingAmount = amount
# Find the number of one dollars
numberOfOneDollars = remainingAmount // 100
remainingAmount = remainingAmount % 100
# Find the number of quarters in the remaining amount
numberOfQuarters = remainingAmount // 25
remainingAmount = remainingAmount % 25
# Find the number of dimes in the remaining amount
numberOfDimes = remainingAmount // 10
remainingAmount = remainingAmount % 10
# Find the number of nickels in the remaining amount
numberOfNickels = remainingAmount // 5
remainingAmount = remainingAmount % 5
# Find the number of pennies in the remaining amount
numberOfPennies = remainingAmount
# Display results
print("Your amount " + str(amount) + " consists of \n" +
"\t" + str(numberOfOneDollars) + " dollars\n" +
"\t" + str(numberOfQuarters) + " quarters\n" +
"\t" + str(numberOfDimes) + " dimes\n" +
"\t" + str(numberOfNickels) + " nickels\n" +
"\t" + str(numberOfPennies) + " pennies")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。