Which is the best way to find out whether the division of two numbers will return a remainder? Let us take for example, I have an array with values {3,5,7,8,9,17,19}. Now I need
You can use the % operator to find the remainder of a division, and compare the result with 0.
%
0
Example:
if (number % divisor == 0) { //code for perfect divisor } else { //the number doesn't divide perfectly by divisor }