Example: Interest Payments

The interest due the second year on a $100,000 25 year loan is calculated. The loan is at 8%.
using System;
using Imsl.Finance;

public class ipmtEx1
{
    public static void  Main(String[] args)
    {
        double rate = .08;
        int per = 2;
        int nper = 25;
        double pv = 100000.00;
        double fv = 0.0;
        
        double ipmt = Finance.Ipmt(rate, per, nper, pv, fv, 
                                   Finance.Period.AtEnd);
        Console.Out.WriteLine("The interest due the second year on the"
                              + " $100,000 loan is " + 
                              ipmt.ToString("C"));
    }
}

Output

The interest due the second year on the $100,000 loan is ($7,890.57)

Link to C# source.