Why does this code give me an error code because of possibly lossy conversion and this one doesnt?
This one works: 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 x = 0; int newAmount = amount; while (x < 3){ newAmount = newAmount - newAmount / 10; x++; } System.out.println(newAmount); } } But this one doesnt: 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 x = 0; int newAmount = amount; while (x < 3){ newAmount = newAmount - newAmount * 0.1; x++; } System.out.println(newAmount); } }