Example: Depreciation - Straight Line Method

The straight line depreciation for one period of an asset with a life of 24 months, an initial cost of $2500 and a salvage value of $500 is computed.
using System;
using Imsl.Finance;

public class slnEx1
{
    public static void  Main(String[] args)
    {
        double cost = 2500;
        double salvage = 500;
        int life = 24;
        
        double sln = Finance.Sln(cost, salvage, life);
        Console.Out.WriteLine("The straight line depreciation of the " + 
                              "asset for one period is " + 
                              sln.ToString("C"));
    }
}

Output

The straight line depreciation of the asset for one period is $83.33

Link to C# source.