+ 1

Loan Calculator Java

https://www.sololearn.com/learning/eom-project/1068/949 My first answer to the task was this: for(int i = 1; i <= 3; i++){ amount /= 100; amount *= 90; } System.out.println(amount); It does work for the first 2 test cases, but not for the remaining 3. When I rewrite the code to this amount = amount * 90 / 100; or amount *= 90; amount /= 100; it's working for all 5 test cases. I can't really retrace what the difference between the two calculations is, since only the first two test cases are open (Test Case 1 Input: 100000, Output: 72900; Test Case 2 Input: 500000, Output: 364500). Explanations and especially examples are higly appreciated!

23rd Sep 2021, 10:13 AM
Giulietta
Giulietta - avatar
1 ответ