Why is a number divisible by 3 if it equals 0?


I thought it’d be number % 3 = / 0
because if a number is divisible by another, its quotient should have a remainder of 0.


what does this mean?

Well, the modulo operator (%) calculates the remainder, if the remainder is zero, the number is divisible by the divider (3 in this case)


number is said to be divisible by any number if the remainder comes out to be 0. eg. if 15 is divided by 3 remainder will be 0.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.