Loan Repayment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <cmath>
using namespace std;
int main()
{

	double k=0,k_0,v,g,p,q,n;
	cout<<"Taken money for the credit = ";
	cin>>k_0;
	cout<<"Payment = ";
	cin>>v;
	cout<<"Months = ";
	cin>>n;
	cout<<"Interest rate = ";
	cin>>p;
	q=1+p/100;
	for (int i=1; i<=n; i=i+1)
	{k=k_0*pow(q,n)-v*(pow(q,n)-1)/(q-1);
	k=k*i;

	cout<<"Remained = "<<k<<endl;}
	return 0;
}

I have a mistake in the operator for. I want to make a cicle which shows the remained amount of money for the loan repayment in the previous months including the one that is typed. For example, if k_0=5; v=1, n=2, p=100 the result should be k=17 and k=9, I want to calculate how much it will remain in the same formula but with another value of n(month), if n=4
I want all the calculations for n=4,n=3, n=2,n=1. This line k=k*i is wrong, and maybe the structure of for, any solutions can help! Thanks in advance!
Topic archived. No new replies allowed.