0

Why is this code wrong

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 int m yloan=0; for(int i=0;i<3;i++){ myloan =amount -=(amount /100*10); } System.out.println(myloan ); } }

4th Jun 2022, 12:08 PM
Modu Babagana
1 Answer
+ 5
Please tag the relevant programming language ("Java"). – The ";" after "int m" is missing – "yloan" is missing data type and ";" – "... = ... -= ..." is not a valid expression and you need to reduce from the remaining amount, not from the initial amount, hence it is "amount = amount - amount/100*10" (then output the final remaining amount)
4th Jun 2022, 12:28 PM
Lisa
Lisa - avatar