问题描述
我是 ruby on rails 的新手,我怀疑如何进行定期存款计算.我使用了一个公式来计算每月利息,它适用于第一个月,而不是计算接下来几个月(第二个月、第三个月...... n 个月)的准确利息.我使用的公式如下.
I'm new to ruby on rails and my doubt is how to do recurring deposit calculations. i have used one formula to calculate monthly interest and that is working for first month and not calculating accurate interest for the upcoming months(2nd month, 3rd month ... n months).Formula i used is given below.
总计 = 存款金额 * 利率 * 30/365
total = depositamount * rate of interest * 30 / 365
请帮我解决这个问题.-谢谢.
Kindly help me to solve this issue.-Thanks.
推荐答案
如果第一个月计算正确,后续月份计算错误,您是说要复利公式吗?(即在第 2 个月,您计算本金利息 + 前几个月的利息)
If the first month calculation is correct and subsequent months are wrong, are you saying that you want a compound interest formula? (i.e. in month 2 you calculate interest on principle + previous months' interest)
toal = deposit_amount * (rate_of_interest*30/365)**month_number
这篇关于如何准确计算定期存款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!