+ 1
Can some one plz tell me what is modulus
Java script
3 Answers
+ 2
% is the remainder operator that is used to get the remainder after division. For example:
7 % 3 // = 1 ; because 3 * 2 gets you 6, and 7- 6 is 1.
There are a lot of languages where it is used
0
Tnx
0
It is the rest of the euclidian division (integers only)
Exemple: 16 / 3 = 5 rest 1 cause 16 = 3*5 + 1
So 1 would be the modulus : 16%3 = 1
You can use modulus to spot odd numbers : if(x%2 == 1) x is odd