1 Star 0 Fork 0

余超/20189220余超 java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Exercise3_8.py 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
余超 提交于 6年前 . python的代码
# 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")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yuchao20189220/over_20189220java.git
git@gitee.com:yuchao20189220/over_20189220java.git
yuchao20189220
over_20189220java
20189220余超 java
master

搜索帮助