【发布时间】:2016-07-25 07:21:13
【问题描述】:
公式
投资余额 (Y) = P*(1+r)^Y + C *(((1+r)^(Y+1) – (1+r))/r)
Where:
Y = number of years invested (investment time frame)
P = principal investment amount (current $ value of initial investment to be made)
r = assumed rate of return p.a. (expressed as a decimal, so 5% return would be 0.05)
C = amount of regular contributions pa
Salary: $100,000
Y: 20 years
P: $50,000
r: 0.05
C: 6521
输出:359069.1263
大家好,我有这个公式,我想用 C# 或 JavaScript 来实现它。我尝试了很多,但没有得到预期的输出,所以云任何人请描述或编写我可以理解实现的示例代码。将不胜感激。
【问题讨论】:
-
请向我们展示您目前编写的代码。也向我们展示你得到的输出。
-
“我尝试了很多” 证明它!
标签: javascript c#