Example: Depreciation - Sum-of-years' Digits

The sum-of-years' digits depreciation for the 14th year of an asset with a life of 15 years, an initial cost of $25000 and a salvage value of $5000 is computed.
using System;
using Imsl.Finance;

public class sydEx1
{
    public static void  Main(String[] args)
    {
        double cost = 25000;
        double salvage = 5000;
        int life = 15;
        int per = 14;
        
        double syd = Finance.Syd(cost, salvage, life, per);
        Console.Out.WriteLine("The depreciation allowance for the 14th"
                              +" year is " + syd.ToString("C"));
    }
}

Output

The depreciation allowance for the 14th year is $333.33

Link to C# source.