- 2
Can anyone help me in doing loan calculator program?
1 Respuesta
0
In C++ :
`````````````````````````````````````````````````````````````````````````````````````````
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// Get the loan amount.
double loanAmount;
cout << "Enter the loan amount: ";
cin >> loanAmount;
// Get the interest rate.
double interestRate;
cout << "Enter the interest rate: ";
cin >> interestRate;
// Get the number of years.
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// Get the loan amount.
double loanAmount;
cout << "Enter the loan amount: ";
cin >> loanAmount;
// Get the interest rate.
double interestRate;
cout << "Enter the interest rate: ";
cin >> interestRate;
// Get the number of years.
int numberOfYears;
cout << "Enter the number of years: ";
cin >> numberOfYears;
// Calculate the monthly payment.
double monthlyPayment = loanAmount * (interestRate / 12) / (1 - (1 + interestRate / 12)^(-numberOfYears));
// Print the monthly payment.
cout << fixed << setprecision(2);
cout << "The monthly payment is quot; << monthlyPayment << endl;
return 0;
}