21 lines
477 B
C++
21 lines
477 B
C++
#include<iostream.h>
|
|
#include<math.h>
|
|
int main()
|
|
{
|
|
int Amount,Years;
|
|
float yrate,mrate,mpay,tpay;
|
|
cout<<"Loan Amount:";
|
|
cin>>Amount;
|
|
cout<<"Number of Years:";
|
|
cin>>Years;
|
|
cout<<"Interest Rate"<<' '<<"Monthly Payment"<<' '<<"Totally Payment\n";
|
|
for(yrate=0.05000;yrate<=0.08000;yrate=yrate+0.00125)
|
|
{
|
|
mrate=yrate/12;
|
|
mpay=(Amount*mrate)/(1-1/pow((1+mrate),Years*12));
|
|
tpay=mpay*12*Years;
|
|
cout<<yrate*100<<"%"<<" "<<mpay<<" "<<tpay<<endl;
|
|
}
|
|
return 0;
|
|
}
|