Operators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Operators

How does the modulo operator work like 20%6 and the ans is 2 how does the 2 come up

3rd Aug 2021, 8:08 AM
Mugumya Timothy
Mugumya Timothy - avatar
5 Answers
+ 6
total 20 3×6 = 18 20 -18 = 2 The remainder of 20/6 is 2
3rd Aug 2021, 8:51 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
% ---> remainder
3rd Aug 2021, 8:34 AM
Atul [Inactive]
+ 1
It's about remaining of division.
3rd Aug 2021, 8:34 AM
farkhondeh
0
20/6 is 18 and 20-18 is 2 so it is the remainder of the division
4th Aug 2021, 9:40 PM
Karol Winkel
Karol Winkel - avatar