0
Java Test Case (Loan Calculator) not working
my code: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); //your code goes here for(int i=0; i<=2; i++) { amount-=(amount/100)*10; } System.out.print(amount); } } input: 500000 expected: 364500 my output: 364500 but the test is not valid ?!
4 Answers
+ 6
You need to change the operators
Correct -> amount-=(amount*10)/100;
Yours -> amount-=(amount/10)*100;
+ 1
Simba, thank you very much! I'll go get some sleep, otherwise I'm already inattentive
0
Input
100000
Your Output
-72900000
Expected Output
72900