You can use the modulo % operator:
numberTwo % numberOne == 0
Modulo finds the remainder of the integer division between two numbers, for example:
20 / 3 = 6 20 % 3 = 20 - 6 * 3 = 2
The result of 20/3 is 6.666667 - the dividend (20) minus the integer part of this division, multiplied by the divisor (3 * 6), is the module (20 - 6 * 3), equal to 2 in this case.
If the module is equal to zero, then the dividend is a multiple of the divisor
More information about the module on the page of this wikipedia page.
source share