Skip to content
Advertisement

How do I check divisibility in Java?

I am trying to check if on number is divisible by another, and currently I use this method:

JavaScript

Is there a simpler way?

Advertisement

Answer

You can use modulus operator like this in your condition,

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement