I'm trying to use "reverse engineering" to understand what the calculation is for the module ( %
), but I can not understand and wanted to understand and clarify myself, to clarify this part, before moving forward and start doing exercises with it.
Then I saw this example:
If we do
23 % 10,
we divide 23 by 10 which equals 2 with 3 left over. So23 % 10
evaluates to3
.More examples:
17 % 5
evaluates to2
13 % 7
evaluates to6
In this first example it says that we split 23 / 10
which is equal to 2
but in fact if we did that calculation would give 2,3
. So I thought, maybe what this means is:
23 % 10
equal to 2 with 3 out, should mean23 / 3
equal to2,3
, then this would be the ratio of equal to2
and3
out?!
But then when I applied this theory in the following examples, this theory did not apply ... I also thought it could be the division of the number 23
by 2 that rounded would be 10 10 leaving the 3 out, but this theory too would not have logic because otherwise it would be 23 % 2
instead of 23 % 10
.