复利公式:
Formula to calculate compound interest annually is given by:
Compound Interest = P(1 + R/100)r
Where,
P is principle amount
R is the rate and
T is the time span
例子:
Input : Principle (amount): 1200
Time: 2
Rate: 5.4
Output : Compound Interest = 1333.099243
C++
// CPP program to find compound interest for
// given values.
#include
using namespace std;
int main()
{
double principle = 10000, rate = 10.25, time = 5;
/* Calculate compound interest */
double CI = principle * (pow((1 + rate / 100), time));
cout << "Compound interest is " << CI;
return 0;
}
Please refer complete article on Program to find compound interest for more details!Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.