Last active
March 23, 2021 16:42
-
-
Save XGFan/aa58f92076f5a12e83fd46e6ba1f2b4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
//fmt.Println(700000 / 360) | |
//fmt.Println(700000 * 3.25 / 100 / 12) | |
//fmt.Println(700000/360 + 70*10000*3.25/100/12) | |
//每月公积金4000 | |
repayment() | |
} | |
func repayment() { | |
total := 700000.0 | |
rate := 3.25 | |
account := 200000.0 | |
income := 9000.0 | |
var i int | |
f := total / 360 | |
for i = 1; account <= total; i++ { | |
shouldPay := f + (total * rate / 100 / 12) | |
total -= total / 360 | |
account += income - shouldPay | |
fmt.Println(i, "total:", total, "should", shouldPay, "account:", account) | |
if i%12 == 0 { | |
total -= account | |
account = 0 | |
fmt.Println("Reload", "total:", total, "account:", account) | |
} | |
} | |
fmt.Println(i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment