Im stuck on "money maker"

hello, im a little stuck on money maker project. it looks that i did everything right but it calculates wrong , it seems to add 1 gold coind everytime etc…

hope someone can help me , (look at the picture there you can see the code i made and in the console u see what happens if i put in 16 and 28 ,

thanks <3

(my code: https://gist.github.com/1ae64242e67e0e10f4806e80e4700e1e )

Using Math.round means that it will either round up or down, depending on the amount. So Math.round(10.6) will give 11, whereas Math.round(10.2) will return 10. This might be useful to read.

3 Likes

so the code is correct? But then i give more money becouse with 28 i give like 15 cents too much right?

Math.round rounds up or down. You want to round down, so you get the lowest amount of gold and silver coins.

2 Likes

ahh i understand now… sorry haha xd , i just need to use Math.Floor() … thanks for the help <3

1 Like