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

remainder

How much will 5%7 and why?

25th Jul 2017, 5:41 PM
Goga
6 Answers
+ 4
5 / 7 is 0.71, true. But that's just division. 7 does not go into 5, so 5 is what's left over. Think of it as whole number division: 7 / 5 = 0. Remaining: 5 Even for decimals: 7 % 2.5 7 / 2.5 = 2. Remaining: 2 (7 - 5 = 2, 2.5 does not go into 2)
25th Jul 2017, 6:18 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Woops I read the question backwards lol. (Disregard what I said previously) 7 Does NOT go into 5. Therefore, the remainder is 5. 5 / 7 < 1.
25th Jul 2017, 5:54 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
I keep it in my mind like this 5/7 = how many 7s are there in 5 ? none right ? so 5 remaining .. so the answer is 5
25th Jul 2017, 6:14 PM
nadz
nadz - avatar
+ 1
5 is less than 7, so the answer is 5?
25th Jul 2017, 5:57 PM
Goga
+ 1
Yes. For example if I had 8 % 7. 7 goes into 8 once. The remainder is 1: 8 - 7 = 1. If I had 15 % 7. 7 goes into 15 twice. The remainder is 1. 15 - 7 = 8. 8 - 7 = 1. You can also think of it as floor division. (But keeping track of the remainder) 15 / 7 = 2. Remainder: 1. PS: sorry about writing that stuff backwards, fixed my original, hopefully it makes sense now. Having a brain fart day. 😜
25th Jul 2017, 5:59 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
The result of a% b is the remainder of dividing a by b, that is, 5/7 will be 0.71. Why answer 5?
25th Jul 2017, 6:11 PM
Goga