Example: Number of Periods for an Investment
Someone obtains a $20,000 loan at 7.25% to buy a car. They want to make $350 a month payments. Here, the number of payments necessary to pay off the loan is computed.
using System;
using Imsl.Finance;
public class nperEx1
{
public static void Main(String[] args)
{
double rate = 0.0725 / 12;
double pmt = - 350.0;
double pv = 20000;
double fv = 0.0;
double nperiods;
nperiods = Finance.Nper(rate, pmt, pv, fv,
Finance.Period.AtBeginning);
Console.Out.WriteLine("Number of payment periods = "
+ nperiods);
}
}
Output
Number of payment periods = 69.7805113662826
Link to C# source.