Question: You have probably discovered that the % operator performs the remainder operation when used with two positive integer arguments. But what does it do when

You have probably discovered that the % operator performs the remainder operation when used with two positive integer arguments. But what does it do when one or both argu-
ments are negative?
>>>11%3
2
>11%-3
-1
>>>-11%3
1
>>-11%-3
-2 Try to come up with an explanation of this behavior. To do so, make a chart of the values from -15 to 15, and for each compute the result when used with the mod operator and the value 3. Then do the same chart with -3. Can you see a pattern? From this pattern can you
explain the behavior of the mod operator?
2/2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!