0

My Loan Calculator does not work

Hello would you please tell me what i am doing wrong? import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); for(int i=0;i<3;i++){ amountNew= amount*10/100; amount-=amountNew; } System.out.println(amount) } }

29th Mar 2021, 7:38 AM
Aida Mehrparvar Hosseini
4 Réponses
+ 3
You're missing a semicolon at the end System.out.println(amount); Also you need to declare the data type for amountNew int amountNew
29th Mar 2021, 8:09 AM
Simba
Simba - avatar
+ 1
Thank you very much
29th Mar 2021, 8:22 AM
Aida Mehrparvar Hosseini
0
I had the very same problem. This is not my code. This is somebody else's code but I have been studying it as an example so I'll put it in a comment so you can study it as well
30th Mar 2021, 3:08 AM
Ava
Ava - avatar
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int remaining = amount ; //your code goes here for(int i=0 ; i<3 ; i++){ int payment= ((amount*10)/100); remaining = amount - payment ; //System.out.println(payment); amount = remaining ; } System.out.println(remaining); } }
30th Mar 2021, 3:08 AM
Ava
Ava - avatar