0

My problem with this program is within my do while loop. From line 33 to line 47. Please find attached the original intention in the pdf document

`

```
//Program to show loan and interest calculation
#include <iostream> // for cin, cout
#include <string>
using namespace std;
const double ANN_INTEREST=0.05; //simple annual interest rate of 5%
int main()
{
double loan, ann_interest, monthly_payment, interest_rate, interest_paid, rem_bal, total_interest_paid, payment, month_interest=(1/12); //declaration of loan and interest rate
int payment_count=1; //declaration of the payment serial numbers
// Welcome message
cout<< "$$-$+$-$+$-$+$-$+$-$+$-$$\n"
<< "$$ $$\n"
<< "... Topiloe's Bank ... $$\n"
<< "$$ $$\n"
<< "$$-$+$-$+$-$+$-$+$-$+$-$$\n";
cout<<"What is the amount of your loan? ";
cin>>loan;
cout<<"What is the interest rate? ";
cin>>interest_rate;
cout<<endl;
monthly_payment=loan*ANN_INTEREST;
cout<<"Monthly payment on a loan of "<<loan<<" is "<<monthly_payment<<endl;
cout<<endl;
cout<<"Payment Details: \n";
cout<<"Payment Number\t"<<"Interest Paid\t"<<"Remaining Balance\n";
cout<<"--------------\t"<<"-------------\t"<<"-----------------\n";
payment=(20/100)*loan;
interest_paid=(interest_rate/100)*loan*month_interest;
rem_bal=loan-interest_paid;
cout<<payment_count<<"\t\t"<<interest_paid<<"\t\t"<<rem_bal<<endl;
do
{
interest_paid=((interest_rate/100)*rem_bal)*month_interest;
rem_bal=payment-interest_paid;
payment_count++;
cout<<payment_count<<"\t\t"<<interest_paid<<"\t\t"<<rem_bal<<endl;
payment_count++;
total_interest_paid=+interest_paid;
}
while (rem_bal!=0);
cout<<"Total interest paid is "<<total_interest_paid<<endl;
```

`

*Edited 2 Years Ago by Ezekiel_1*: correction