+ 3
How to make compound interest program in C++?
How to express the formula in it?
3 odpowiedzi
+ 18
pow(a,b);
//U only need to know this function
+ 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;
}
+ 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.