How does print(17%3) equals 2? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does print(17%3) equals 2?

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

22nd Feb 2021, 5:49 PM
Programmer269
Programmer269 - avatar
12 Answers
+ 6
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🙂
22nd Feb 2021, 6:26 PM
Per Bratthammar
Per Bratthammar - avatar
+ 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
22nd Feb 2021, 5:52 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 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.
22nd Feb 2021, 6:39 PM
Ipang
+ 1
17-15 = 2 so 2 is the modulo in this operation 17%3 ==>5*3+2
22nd Feb 2021, 6:07 PM
HBhZ_C
HBhZ_C - avatar
+ 1
Thanks! both of ya'll
22nd Feb 2021, 6:08 PM
Programmer269
Programmer269 - avatar
+ 1
3)17(5 15 2 % value is remainder So,17%3 is 2
24th Feb 2021, 1:42 AM
Pradeep kumar .Chopparapu
Pradeep kumar .Chopparapu - avatar
+ 1
When you divide it with a normal division sign there will be the remainder so the remainder is the answer
24th Feb 2021, 2:30 AM
Samson
Samson - avatar
0
Thank you very much!
22nd Feb 2021, 6:28 PM
Programmer269
Programmer269 - avatar
0
Because % returns the remainder
23rd Feb 2021, 8:23 AM
∆BH∆Y
∆BH∆Y - avatar
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
23rd Feb 2021, 1:16 PM
bernborgess
bernborgess - avatar
0
3)17(5 15 2 % value is currect So,17%3 is 2 & this is the best way
22nd Jan 2023, 2:19 AM
Suman Sarkar
Suman Sarkar - avatar
0
Yes
22nd Feb 2023, 3:49 AM
Samson
Samson - avatar