Module Module1
Sub Main()
Dim strDownPayments As String
Dim decDownPayments As Decimal
Dim strInterest As String
Dim decInterest As Decimal
Dim strYears As String
Dim intYears As Integer
Dim decTotalMortgage As Decimal
Dim lstTotalPerYear As List(Of Decimal) = New List(Of Decimal)
strDownPayments = "100"
decDownPayments = Convert.ToDecimal(strDownPayments)
strDownPayments = decDownPayments.ToString("C")
strInterest = "2.2"
decInterest = Convert.ToDecimal(strInterest)
strInterest = decInterest.ToString("P")
strYears = "5"
intYears = Convert.ToInt32(strYears)
strYears = intYears.ToString("N")
Dim MaxNumberOfEntries As Integer = intYears
Dim IntNumberOfEntries As Integer = 1
Do Until IntNumberOfEntries > MaxNumberOfEntries
'problem is here, decTotalMortgage should be accumulated, but you replaced it with new value in each iteration
decTotalMortgage += decDownPayments * (1 + decInterest)
lstTotalPerYear.Add(decTotalMortgage)
'decTotalMortgage += decDownPayments
IntNumberOfEntries = IntNumberOfEntries + 1
Loop
Console.WriteLine("Down payment = {0}", strDownPayments)
Console.WriteLine("Interest = {0}", strInterest)
Console.WriteLine("Years = {0}", strYears)
For i = 0 To lstTotalPerYear.Count - 1
Console.WriteLine("Mortgage {0} = {1}", i + 1, lstTotalPerYear(i))
Next
Console.WriteLine("Press any key...")
Console.ReadKey(True)
End Sub
End Module