+ 3

Why is 8 % 5 not 6?

The result from 8 / 5 is 1.6 right? Then why is 8 % 5 not 6??

5th Sep 2016, 10:01 AM
Lucien Nestler
Lucien Nestler - avatar
12 Réponses
+ 7
8/5=(5/5)+(3/5) so 8%5=3
5th Sep 2016, 11:25 AM
mohamad.khalili
+ 3
When you write 8%5 imagine you're dividing 8 by 5. You take the integer which in this case is 1 and once you see you can't divide it any more without making it a decimal, you stop. The rest of dividing 8 by 5 is 3 and that's the modulo (the result) of that operation.
5th Sep 2016, 10:11 AM
Carlos Torres
+ 3
@Lucien, other way to look at is 8/5 =1.6 but .6 remainder is out of 10 that's why its called decimals. In our case we need out of 5 so remainder is (6/10)*5 =3.
6th Sep 2016, 8:58 AM
Satyajit Behera
Satyajit Behera - avatar
+ 2
division (/) is differ from % % mean you got rest of number after division
5th Sep 2016, 2:15 PM
gurkirt Singh
gurkirt Singh - avatar
+ 1
8%4 gives 0... because no remainder. 8%2 gives 0... because no remainder... 8%3 gives 2 because after 3 divides into 8 twice (6), there is a reminder of 2.
9th Sep 2016, 2:03 PM
Luke Etyrnal
Luke Etyrnal - avatar
0
Ahhh, I think I got it! Trank you very much!
5th Sep 2016, 10:13 AM
Lucien Nestler
Lucien Nestler - avatar
0
because the operator is only returning the remainder
9th Sep 2016, 2:00 PM
Luke Etyrnal
Luke Etyrnal - avatar
0
% will return the remainder of 8 / 5
10th Sep 2016, 3:22 AM
gmzdev
gmzdev - avatar
0
5 goes into 8 only 1 time with a remainder of 3.
11th Sep 2016, 6:32 PM
James Baker
James Baker - avatar
0
8%5 is 3
14th Sep 2016, 5:27 AM
Omar Alejandro Cervantes Yepez
Omar Alejandro Cervantes Yepez - avatar
0
because when we devide 8 by 5, the reminder is 3, not 6
19th Sep 2016, 2:23 PM
Alisher Zhardemgaliyev
0
8℅5 you are taking out the modulus of it. as you know modulus answer is remainder. so the answer will be 3
10th Nov 2016, 5:21 PM
Senpai Anubhav
Senpai Anubhav - avatar