Back to General discussions forum
I think the checker has a problem for inputs where, the principal is below 100, the total final amount is less than 1000 and the interest rate is 1%
Hi Friend! Sorry, but after thinking a bit, I'm not sure what exactly problem do you mean. Could you please provide specific test case - input data, wrong and correct answer?
Hi,
Under below conditions:
Case : Principal : 50, Target Amount : 1000, Rate of Interest : 1
Checker Answer: 303 My answer: 302
For every other case my answer matches with the checker. I solved the Mortgage Calculator already before this, but I cannot figure out where I am going wrong or if the checker is wrong.
Please advice.
Thanks and Regards, Tinoy Mathews
Hi there!
I haven't checked yet, but it seems your code slightly deviates from what problem asks:
round( xFinalAmount + ( xFinalAmount*xRate )/100, 2 )
this is not round down but round to nearest. While we want rounding down (as banks generally do).