Help-monthly loan payment!

Hello, I need some help with this program. I did the monthly loan calculation but I don't know how to do the part where it says
1). the interest rate go from 5% to 8%, with an increment of 1/8.
2). Display the table?

This is the first I'm using C++ and I'm learning.
Any suggestion/ideas are more than welcome! Thanks in advance!

Write a program that lets the user enter loan amount and loan period in number of years and display the monthly and total payments for each interest rate from 5% to 8%, with an increment of 1/8.
If you enter the loan amount 10,000 for five years, it will display a table as follows:

Loan amount: 10000
Number of years: 5

Interest Rate: Monthly Payment Total Payment

5% 188.71 11322.74
5.125% 189.28 11357.13
5.25% 189.85 11391.59
…..

7.85% 202.16 12129.97
8.0% 202.76 12165.83


Here is my code and it works ok:

#include <iostream.h>
#include <iomanip.h>
#include <math.h>

int main()
{

double loan_amt, int_rate, years, monthly_payment, total_payment;

cout<<"\nEnter your loan amount $ ";
cin>>loan_amt;
cout <<" \nEnter the interest rate: ";
cin >> int_rate;
cout<<"\nEnter your desire loan period: ";
cin>>years;

monthly_payment = (loan_amt * int_rate / 1200) / ( 1 - pow( 1 / ( 1 + int_rate / 1200), 12 * years));

total_payment = monthly_payment * 12 * years;

cout<< "\nThe monthly payment is $ " << monthly_payment;
cout<< "\nThe total amount paid is $ " << total_payment;

return 0;
}

Topic archived. No new replies allowed.