Loan Calculator Monthly Repayment - C#

Loan Calculator Monthly Repayment - C#

code snippet

c#
public string LoanCal(int t, double l, double r)
{
    // t=total month, l=loan amount, r=annual rate
    double totalrepay = 0;
    double rate = r / 12;
    if (r == 0)
    {
        totalrepay = l/t;
    }
    else
    {
        totalrepay = (l * r / 12) / (1 - Math.Pow((double)(1 + r / 12), 0 - t));
    }
    // return monthly repayment
    return totalrepay.ToString();
}

"One today is worth two tomorrows"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.