Example: Cumulative Interest Example

The amount of interest paid in the first year of a 30 year fixed rate mortgage is computed. The amount financed is $200,000 at an interest rate of 7.25% for 30 years.
using System;
using Imsl.Finance;

public class cumipmtEx1
{
    public static void  Main(String[] args)
    {
        double rate = 0.0725 / 12;
        int periods = 12 * 30;
        double pv = 200000;
        int start = 1;
        int end = 12;
        double total = Finance.Cumipmt(rate, periods, pv, start, end,
                                       Finance.Period.AtEnd);
        Console.Out.WriteLine("First year interest = " + 
                               total.ToString("C"));
    }
}

Output

First year interest = ($14,436.52)

Link to C# source.