I haven't tested the following before, but probably it will help you: Code (Text): int firstNumber = 2000; int secondNumber = 8; if (firstNumber % secondNumber == 0) System.out.println(firstNumber + " is divisible by " + secondNumber);
You can use the modular operator, %, and check two different inputs. Code (Text): int a = 10; int b = 5; if (a % b == 0) { .... /** is divisible */ }