think i got everything right expect the answer
can someone who solved this please send me a pm so we can check the values my program produces, because i don't want to post them here?
I was doing everything correct but always getting wrong answer. The problem was because I was truncating instead of rounding. For those who are getting wrong answer, remember to round! Preferable use a round function.