emi 计算器:
emi 计算器可帮助您轻松估算每月分期付款。一旦您输入必要的详细信息,例如贷款金额、贷款期限和利率,银行的 emi 计算器将立即显示您估计的等值每月分期付款 (emi)。
要计算 emi,您可以使用以下公式:
emi = [p x r x ( 1 + r )^n] / [( 1 + r )^n -1]
地点:
p = 本金
r = 月利率(年利率/12个月)
n = 贷款期限(以月为单位)
示例:
# input the loan amount loan = int(input("enter the loan amount: ")) # input the loan tenure in years and convert to months tenure_year = int(input("enter the loan tenure in years: ")) tenure_month = tenure_year * 12 # convert years to months print("loan tenure in months:", tenure_month) # input the interest rate per year and convert to monthly interest rate interest_year = float(input("enter the interest per year: ")) interest_month = interest_year / 12 / 100 # convert annual interest rate to monthly decimal rate print("interest per month in percentage:", interest_month) # calculate emi using the formula emi = loan * (interest_month * (1 + interest_month) ** tenure_month) / ((1 + interest_month) ** tenure_month - 1) # display the calculated emi, rounded to 2 decimal places print("emi:", round(emi, 2))
输出:
Enter the loan amount:500000 Enter the loan tenure in years :10 Loan tenure in months: 120 Enter the interest per year:3.5 Interest per month in percentage: 0.002916666666666667 EMI: 4944.29
以上就是编写 EMI 计算器程序的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号