+ 3
Why is 8 % 5 not 6?
The result from 8 / 5 is 1.6 right? Then why is 8 % 5 not 6??
12 Respuestas
+ 7
8/5=(5/5)+(3/5) so 8%5=3
+ 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.
+ 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.
+ 2
division (/) is differ from %
% mean you got rest of number after division
+ 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.
0
Ahhh, I think I got it! Trank you very much!
0
because the operator is only returning the remainder
0
% will return the remainder of 8 / 5
0
5 goes into 8 only 1 time with a remainder of 3.
0
8%5 is 3
0
because when we devide 8 by 5, the reminder is 3, not 6
0
8℅5 you are taking out the modulus of it. as you know modulus answer is remainder. so the answer will be 3