Can anybody explain | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Can anybody explain

How 2%7 is 2

11th May 2021, 7:13 PM
ajay singh
ajay singh - avatar
4 Answers
+ 1
Because you can replace the multiple withany (pos) integer. For example: day start at 12:00 at midnight. Time: 10:00 o’clock AM . (10 day zero) Tomorrow same time (10 + 24) = 34 Day after that 10 + 48 = 58 After that 10 + 72 = 82 So to explain what the time is 10, 34, 58 and 82 hour after that midnight: 10 % 24 (day 0) 34 % 24 (day 1) 58 % 24 (day 2) 82 % 24 (day 3) All became 10 (10:00 AM) 10 + day * 24 = hour (formula) hour % 24 = 10 (modulo)
11th May 2021, 7:46 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
Thanks a lot
11th May 2021, 8:21 PM
ajay singh
ajay singh - avatar
+ 1
Because 2 is the rest. 2 % 7 = 2 because 2 + 7 * 0 = 2 9 % 7 = 2 because 2 + 7 * 1 = 9 16 % 7 = 2 becuase 2 + 7 * 2 = 16 etc
11th May 2021, 7:20 PM
Per Bratthammar
Per Bratthammar - avatar
0
Why 7*0
11th May 2021, 7:25 PM
ajay singh
ajay singh - avatar