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 ); } }
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)