Computer Science Canada

err? looping formula error?

Author:  JustTrying2GetBy [ Fri Nov 05, 2004 1:09 am ]
Post subject:  err? looping formula error?

code:

const interest_rate := 0.115
const payment := 8600
var mortgage : int := 85000
var b : int := 0
var interest, balance : real

put "Year", " " : 10, "Interest", " " : 10, "Balance"

loop
    interest := mortgage * interest_rate
    balance := mortgage + interest - payment
    b := b + 1
    put b, " " : 13, "$ ", interest, " " : 11, "$ ", balance
    exit when b = 15
end loop


too tired to think...something wrong with my formula or sumthing...(the balance is soupposed to increase with every year of payment). first interest increasement shows up 0........starting mortgage-$85,000 annual intrest rate - 11.5%, payments are $8600/yr. Intrest is addded before payments are deducted.

how do i fix problem Question

Author:  Delos [ Fri Nov 05, 2004 12:52 pm ]
Post subject: 

You need to change the value of the mortgage! It's no use calculating the interest if you're not going to add it to the mortgage.


: