 How does print(17%3) equals 2? | Sololearn: Learn to code for FREE!

0

# How does print(17%3) equals 2?

Sorry guys I'm too dumb to understand this... :/

+5

Hi! You can think like this: the multiplication table for 3 gives: 0, 3, 6, 9, 12, 15, 18, ... So to get 1, 4, 7, 10, 13, 16, 19,... from that table you have to add +1; And to get 2, 5, 8, 11, 14, 17, 20, ... you have to add +2 to that table. => 17 = 15 + 2 => 17 = (5 *) 3 + 2 => 17 % 3 == 2 /Regards Per B🙂

+9

You just have to print your function & it will give you output of 2. Likewise: print(17%3) % modulo operator will give you remainder after dividing it by 17%3

+7

You're not dumb at all! a dumb is one who doesn't understand and yet doesn't try anything to understand. Asking a question means you still got curiosity, a dumb just don't have it, and don't even care about it.

+3

1. Take the nearest number when divided by 3 would be zero. That's apparently 15 2. Subtract 15 from 17 and the result is your answer.

+1

17-15 = 2 so 2 is the modulo in this operation 17%3 ==>5*3+2

+1

+1

3)17(5 15 2 % value is remainder So,17%3 is 2

+1

When you divide it with a normal division sign there will be the remainder so the remainder is the answer

0

0

Because % returns the remainder

0

it is what is left when you perform integer division 17/3. Cause 3*5 is the closest u get to 17, then the remainder is 2