Can some one plz tell me what is modulus | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can some one plz tell me what is modulus

Java script

3rd Mar 2019, 8:35 PM
Killer J
Killer J - avatar
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
3rd Mar 2019, 8:50 PM
coding-space.ru
coding-space.ru - avatar
0
Tnx
3rd Mar 2019, 8:51 PM
Killer J
Killer J - avatar
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
3rd Mar 2019, 8:55 PM
Dyf Dyf
Dyf Dyf - avatar