How to make compound interest program in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to make compound interest program in C++?

How to express the formula in it?

13th Mar 2018, 5:25 PM
Jatin Jadhav
Jatin Jadhav - avatar
3 Answers
+ 18
pow(a,b); //U only need to know this function
13th Mar 2018, 5:39 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
This is the code: #include<iostream> #include<math.h> using namespace std; int main() { float p,r,t,ci; cout<<"Enter Principle, Rate and Time:\n"; cin>>p>>r>>t; ci=p*pow((1+r/100),t); cout<<"\nCompound Interest = "<<ci; return 0; }
13th Mar 2018, 6:09 PM
Baraa AB
Baraa AB - avatar
+ 5
a = p*pow( (1 + r/n) , n*t ); // here , a : amount p : principal r : rate of interest p.a. n : number of times interest is compunded per year t : time in years.
13th Mar 2018, 6:03 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar