Calculating remaining balance [Monthly compounding question with rate= 0.01] Suzanne opens a line of credit at a local bank, and immediately borrows 1870 dollars. 6 months later, she repays 1060 dollars. 5 months after the repayment, she borrows 570 more dollars. 6 months later, she repays 660 dollars. If no other transactions take place and the interest rate is 1 percent per month (compounded monthly), how much will she owe two years after she opened the line of credit? 
First, after 6 months she owes 1870(1+0.01/12)^6=1879.37 and repays 1060
----> she finally owes 819.37 dollars
Then, 5 months after the repayment, she owes 819.37(1+0.01/12)^5 = 822.79 dollars and borrows 570 dollars --->she finally owes 1392.79 dollars.
Then, 6 months later, she owes 1392.79(1+0.01/12)^6 = 1399.77 dollars and repays 660 dollars ---> she finally owes 739.77 dollars.
Since there are 7 months left until 2 years, so 739.77(1+0.01/12)^7 = 744.1 dollars.
I think she owes 744.1 dollars after 2 years.
But this is not right answer and I would like to know where I made a mistake.
Thanks!
 A: The error you made was to divide by 12. Since the interest is accumulated monthly, you don't need to do that. The numbers should look something like this:
1985.04
972.23
1637.11
1047.59

Code to compute it two different ways is here
package main

import (
    "fmt"
    "math"
)

var balance float64

func incMo() {
    balance = 1.01 * balance
}

func main() {
    balance = 1870
    for mo := 1; mo <= 24; mo++ {
        incMo()
        fmt.Printf("%d: %.2f\n", mo, balance)
        switch mo {
        case 6:
            balance -= 1060
        case 11:
            balance += 570
        case 17:
            balance -= 660
        }
    }
    balance = 1870
    balance *= math.Pow(1.01, 6)
    fmt.Printf("%.2f\n", balance)
    balance -= 1060
    balance *= math.Pow(1.01, 5)
    fmt.Printf("%.2f\n", balance)
    balance += 570
    balance *= math.Pow(1.01, 6)
    fmt.Printf("%.2f\n", balance)
    balance -= 660
    balance *= math.Pow(1.01, 7)
    fmt.Printf("%.2f\n", balance)
}

I wasn't sure whether to add the interest before or after the money was deposited or withdrawn, so you might get different answers.
