I'm having problems with "int" in java
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 int a=0; for(int x = 0;x<6;x++) { a = (amount/10); amount = amount-a; } System.out.println(amount); } } Above code is answer of java program in this app (loops section). In test case 100000 answer should be 53144 but my answer is coming 53145. I have figured out that problem lies at "a= amount/10". Here in last loop a value is coming 4.9 at ones place but code is converting it to 4 resulting my answer wrong. I tried ceil function, round off, making a double then converting it further to int but nothing worked... Please help