What is ‘Compound interest’?
Compound interest is the addition of interest to the principal sum of a loan or deposit, or in other words, interest on interest. It is the result of reinvesting interest, rather than paying it out, so that interest in the next period is then earned on the principal sum plus previously-accumulated interest. Compound interest is standard in finance and economics.
Compound interest may be contrasted with simple interest, where interest is not added to the principal, so there is no compounding.
Compound Interest formula:
Formula to calculate compound interest annually is given by:
Amount= P(1 + R/100)t
Compound Interest = Amount – P
Where,
P is principle amount
R is the rate and
T is the time span
But, How to write a program to calculate compound interest in C++, PHP, Javascript, JAVA etc
C++ // CPP program to find compound interest for // given values. #include <bits/stdc++.h> using namespace std; int main() { double principle = 10000, rate = 5, time = 2; /* Calculate compound interest */ double A = principle * (pow((1 + rate / 100), time)); double CI = A- principle; cout <Read more
C++
// CPP program to find compound interest for
// given values.
#include <bits/stdc++.h>
using namespace std;
int main()
{
double principle = 10000, rate = 5, time = 2;
/* Calculate compound interest */
double A = principle * (pow((1 + rate / 100), time));
double CI = A- principle;
cout << “Compound interest is ” << CI;
return 0;
See less}
//This Code is Contributed by Sahil Rai.
good
good
See less