0
Loan calculator problem
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 x = 1; x <= 6 ; x++){ int payment = amount / 10; amount = amount - payment ; } System.out.println (amount ); } } The result is always up by one. Why is that and how can I fix it?
1 Réponse
+ 2
Ozzy Cohen
Do this
amount = amount - amount * (100 - 90) / 100;