0

Output (list)

y=11 x=2*(y%3) print(x*y) Solution: 44 What am I missing? Thanks.

20th Mar 2019, 4:14 AM
tristach605
tristach605 - avatar
4 Answers
+ 5
11%3 is 2 and x = 2*2 = 4 % is operator which gives reminder when we do x/y... as, 11 = 3*3 + 2. 11//3= 3 and 11%3 = 2
20th Mar 2019, 5:59 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
% gives reminder... for example, 55%5 = 0 because (11*5) + 0 = 55 56%5 = 1 bcz (11*5)+1= 56 37%8 = 5 bcz (8*4)+5= 37
21st Mar 2019, 3:00 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
tristach605 read this for modulus..it's in c++ but concept of modulus is same... https://www.sololearn.com/learn/CPlusPlus/1609/
21st Mar 2019, 3:03 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Thanks Kenta and Jay:). So, when I solve for %, I have to always divide the remainder twice? y=11 x=2*(y%3) print(x*y) y = 11 x = 2*(11%3) = 2 * (11/3 becomes 3.6/3 becomes 1.2 or "2") y = 11 x = 2 * (2) = 4 print(11x4) solution: 44
20th Mar 2019, 10:49 PM
tristach605
tristach605 - avatar