0
Please help me complete the Loan calculator problem in java. My code is below
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 percen= amount /10; int new= amount - percen System.out.println(new); } }
2 Answers
+ 1
Aditya Mukherjee
Take amount as double
double amount = scanner.nextDouble();
for(int i = 0; i <= 6; i++) {
amount = amount - Math.ceil(amount / 10);
}
System.out.println((int) amount);
0
Thanks