複利 C 程式?
複利是按年複利計算的簡單利息,即利息每年都會計算並新增到本金中。與簡單利息相比,這增加了總體利息。有一個用以計算複利的不同的數學公式。我們透過一個示例來看看:
Input:p=5, r=4, t=5 Output:1.083263
說明
Compound Interest = Principle * (1 + Rate / 100)^time CI=5*(1+4/100)^5 CI=1.083263
示例
#include <iostream> #include <math.h> using namespace std; int main() { float p, r, t, ci; p=5; r=4; t=5; ci = p * pow((1 + r / 100), t) - p; printf("%f", ci); return 0; }
廣告