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) } }
4 ответов
+ 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
+ 1
Thank you very much
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
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);
}
}