How to calculate depreciation per years in VB.NET

1 Answer

0 votes
Imports System
 
Public Class Program
    Public Shared Sub Main()
        Dim amount, deppercent, years As Double
		
        amount = 1000
        deppercent = 40
        years = 3
		
        Dim amount_left As Double = amount
        Dim annual_depreciation As Double = 0
		
        Console.WriteLine("Initial amout = " & amount_left)
 
        For i As Integer = 0 To years - 1
            annual_depreciation = (deppercent * amount_left) / 100
            amount_left = amount_left - annual_depreciation
            Console.WriteLine("Year {0}: Annual depreciation = {1} Amount left = {2}", i + 1, annual_depreciation, amount_left)
        Next
 
        Console.WriteLine("Amount after depreciation = " & amount_left)
    End Sub
End Class
 
 
 
 
' run:
'
' Initial amout = 1000
' Year 1: Annual depreciation = 400 Amount left = 600
' Year 2: Annual depreciation = 240 Amount left = 360
' Year 3: Annual depreciation = 144 Amount left = 216
' Amount after depreciation = 216
'

 



answered Aug 15, 2021 by avibootz
edited Aug 15, 2021 by avibootz

Related questions

1 answer 208 views
1 answer 227 views
227 views asked Aug 15, 2021 by avibootz
1 answer 282 views
1 answer 236 views
1 answer 248 views
1 answer 422 views
1 answer 264 views
...