Make Interest Table using Loop

I need to make a table using a loop. I need to display The month and the old balance, monthly payment, interest paid, principal paid, and new balance for each month in a table like format. This is all i have so far and i am stuck on making the table with a loop. Please help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 int main(int argc, char** argv) {
    double PR, IY, NM, IM,P,Q,R, MP;
    int NY;//number of years
    cout<<"Lean Amount (principal)?\t\t";
    cin>>PR;
    cout<<"Interest rate per year(percent)?\t";
    cin>>IY;
    cout<<"Number of years?\t\t\t";
    cin>>NY;
    NM=(NY*12);
    IM=(IY/12)/100;
    P=pow(1+IM, NM);
    Q=(P/(P-1));
    MP=(PR*IM*Q);
    cout<<"Loan Amount:\t\t\t\t"<<PR<<endl;
    cout<<"Interest rate per month (IM) : "<<IM<<endl;
    cout<<"Number of months (NM) :\t\t"<<NM<<endl;
    cout<<"Monthly payment is:\t\t"<<MP<<endl;
    
Topic archived. No new replies allowed.