Код: Выделить всё
static double CalculateMontlyRepayment(double loanAmount, double annualInterestRate, int loanTermYears)
{
//convert yearly interest into monthly interest.
double monthlyInterestRate = annualInterestRate / 12.0;
//Figure out number of monthly payments.
int loanTermMonths = loanTermYears * 12;
//The formula to get the monthly payment amount.
double monthlyPayment = loanAmount * (monthlyInterestRate * Math.Pow(1 + monthlyInterestRate, loanTermMonths)) /
(Math.Pow(1 + monthlyInterestRate, loanTermMonths) - 1);
return monthlyPayment;
}
Подробнее здесь: https://stackoverflow.com/questions/782 ... for-a-mort