How to use The modulo (%) operator perfectly

Although many got an explanation about the modulo operator, few really know what purposes it can serve. This tutorial will show some basic applications of the modulo operator, ranging from daily life "issues" till some (extremely simplified) data structures in JAVA.

Before we start, we need to know what exactly the modulo operator is. According to it's definition, it's given as:

Modulo operator (Note that '%' is the modulo operator in Java)
if r = x % y, then a non-negative q exist, such that
x = q*y + r

Now we know the definition of the modulo operator, let's consider some daily life applications, starting with:  more...

No comments:

Post a Comment