Modular question? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Modular question?

hey guys! what the answer is: 2%-8 and how?.....

30th Sep 2017, 3:07 PM
Muhammad Belal
Muhammad Belal - avatar
1 Answer
+ 9
The % operator returns the remainder of a division. I.e. m%n returns remainder of m/n (floor division). 2 divided by -8 is 0 with remainder of 2. Hence 2%-8 returns 2. Please use the search function for more similar questions on modulus operator.
30th Sep 2017, 4:48 PM
Hatsy Rei
Hatsy Rei - avatar