What is the output of x=3 number=17 print number %x | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of x=3 number=17 print number %x

Here eels pls

8th Jan 2017, 7:58 PM
Cat Ola !!!!!
Cat Ola !!!!! - avatar
2 Answers
+ 2
% is the remainder operator (modulo) meaning, the closest number to 17 which is divisable by 3 is 15 (3x5) and the REMAINDER to get 17 is 2, which is the answer 17%3 = 3x5 + 2 edit DFX beat me to the buzzer xD
8th Jan 2017, 8:06 PM
Burey
Burey - avatar
0
17%3=? 17=x*3+remainder=5*3+2 17%3=2 % is the modulus operation the result is the remainder after the division
8th Jan 2017, 8:04 PM
DFX
DFX - avatar