Warcraft III resources & community, 2003–2006 · archived

12 mod 5 = 2???

8 posts
#1

12 mod 5 = 2???

I dont understand this trigger:

Math - Modulo
12 mod 5 = 2

how does it be that?



My english sux, i kown it!
#2

eh?

What's your question?

12 mod 5 = 2 - thats correct...

12 mod 2 = 0 ..

12 mod 7 = 5 ..

and so on...
#3
In the trigger there is an example and it is:
12 mod 5 = 2

But what "mod" means???
#4
Ok kids time for a math lesson. :D

12 MOD 5 = 2

Reason for this is divide 12 by 5 as much as you can. The result of 2 is its remainder.
#5
Ok thx i got i now :D

12 mod 5 = 2.4
and i it remove the last numbers (4) so it be 2
#6
not exactly, here a better example:

17 mod 5 = 2

5 fits 3 times into the 17 (=15), but 2 remains, can't be divided by 5 (integers)
that's where the two comes from
#7
yes

As DarkShadow already sayed

12 modulo 5 = 2

means

12 / 5 = 2.4

now you take the integer value of the solution (2.4 = 2)

now you calc the opposite: 2 * 5 = 10
now you see theres a difference of 2 between 12 and 10 (12 - 10 = 2)

so whats 18 mod 7?

18 / 7 = 2.571428571428572

so 2 * 7 = 14 (the 2 comes from 2.571428571428572)

and 18 - 14 = 4

so 18 mod 7 = 4