Java Loan calculator case 5
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); //loan amt left int paid;//amount paying double accuamt = amount;//mirror input double accupaid;//amount paying decimals for(int x=1; x<=6; x++) { accupaid = accuamt /10;//finding 10% paid = amount/10; //finding10%to1decimal amount = amount - paid; accuamt =accuamt -accupaid;//reducing total amount if((accuamt % amount)>0){ amount --;}//forcing round down if(x==6) System.out.println(amount);//printing values } } } If I don't force a round down, I always have answer +1. This code works for cases 1-4 :c pls halp. I'm SO CURIOUS. Also I read that Java rounds down integer division so this is confusing me. And we havent learnt abt the rounding function so I tried not to use it, unlike some of the other solutions