#include<iostream>
#include<cmath>
usingnamespace std;
int main()
{
int a = 1;
int TotalInterestPaid;
int TotalPayment;
double A, r, t;
double R, x, y;
while (a == 1) {
cout << "Please Enter The Loan Amount:\n";
cin >> A;
cout << "Please Enter the Interest Rate:\n";
cin >> r;
cout << "Please Enter the Number of Years:\n";
cin >> t;
x = r / 1200;
y = 1 - (pow(1 + x, -12 * t));
R = A / (y / x);
TotalPayment = R * (12 * t);
TotalInterestPaid = TotalPayment - A;
cout << "Your Monthly Payment is" << "$" << R << endl;
cout << " Your Total Payment is" << "$" << TotalPayment << endl;
cout << "Total Interest paid is" << "$" << TotalInterestPaid << endl;
cout << "===================================================================" << endl;
cout << "Please enter 1 to continue, or any other number to end the program:" << endl;
cin >> a;
}
return 0;
}
I know you are new here (welcome) but please don't do multiple topics about the same subject, it is ultimately a time waster for those who reply. There is a risk that the same things will be said in both topics. All you question seem to be answered in the other topic.