Finance namespace

You're viewing an older version of this page (#328). View the current version.

View versions (1)

Interface

#include <codecogs/finance/accounting/deprecstraight.h>

using namespace Finance::Accounting;

Calculate the straight-line depreciation of an asset. The following equation is used:

SLN=\frac{cost-salvage}{life}
(1)

Suppose you purchase a boat for £12000 that has a useful life of 20 years and a salvage value of £2000, the depreciation for each year is £500.

Example 1

#include <iostream>
#include <codecogs/finance/accounting/deprecstraight.h>

int
main(int argc, char *argv[])
{
  printf("Depreciation of an asset purchased for 30000,");
  printf("and salvage for 7500 after 10 years is:\n");
  std::cout<<Finance::Accounting::deprecStraight(30000, 7500, 10);
  std::cout<<std::endl;

  return 0;
}

Output:

Depreciation of an asset purchased for 30000, and salvage for 7500 after 10 years is:
2250

Parameters

cost
The initial cost of the asset.
salvage
The value at the end of the depreciation.
life
The number of periods over which the asset is being depreciated, i.e. the <em>useful life</em> of the asset.

Returns

The straight line depreciation of the asset.
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

cost
salvage
life
Result