Hi all,
This program is compiled successfully but it does not do what it is meant to do
# include <iostream>
using namespace std;
int main ()
{
double interest_py, interest_pm, month_pay, loan, interest_due=0;
int counter=0;
cout << "Loan amount =";
cin >> loan;
cout << "Interst per year =";
cin >> interest_py;
interest_pm = interest_py/100/12;
cout << "Monthly payment = ";
cin >> month_pay;
interest_due = interest_pm*loan;
while (month_pay < interest_due)
{
cout << "Monthly payment is too low"
<< "if you want to repay your loan; increase payment"
<< endl;
cin >> month_pay;
interest_due = interest_pm*loan;
}
do
{
loan = loan-(month_pay-interest_due);
interest_due = interest_pm*loan;
counter++;
}
while (loan != 0); // end of do while
if (loan=0)
cout << "Months to repay the loan =" << counter <<endl;
return 0;
}//end