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 ?!

23rd May 2021, 10:26 AM
Кирилл Тусупбеков
Кирилл Тусупбеков - avatar
4 odpowiedzi
+ 6
You need to change the operators Correct -> amount-=(amount*10)/100; Yours -> amount-=(amount/10)*100;
23rd May 2021, 10:45 AM
Simba
Simba - avatar
+ 1
Simba, thank you very much! I'll go get some sleep, otherwise I'm already inattentive
23rd May 2021, 10:47 AM
Кирилл Тусупбеков
Кирилл Тусупбеков - avatar
0
Input 100000 Your Output -72900000 Expected Output 72900
23rd May 2021, 10:34 AM
Кирилл Тусупбеков
Кирилл Тусупбеков - avatar
23rd May 2021, 10:42 AM
Кирилл Тусупбеков
Кирилл Тусупбеков - avatar