Please explain | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please explain

a = 14 b = 7 c = a% (7+1) I know the answer is 6, but how

31st Jan 2019, 4:34 AM
Leonardo Monterey
Leonardo Monterey - avatar
2 Answers
+ 6
c = a% (7+1) Becomes c = a % 8 And because a = 14: c = 14 % 8 Modulus (%) is basically “remainder division”, so when 14 is divided by 8, the answer is 1 but there is 6 left over, so: c = 6
31st Jan 2019, 4:42 AM
Rowsej
Rowsej - avatar
+ 3
Ohhhhhhh!!!!!!!!!!!! thanks ;) I was really spinning my wheels :p
31st Jan 2019, 4:47 AM
Leonardo Monterey
Leonardo Monterey - avatar