Hw do i reverse the mod function. That is: 6 mod 2 is 0. Nw hvn my result 0, dnt knw wat 2 is cald in dis case bt i got it as wel. Hw do i get bak to 6.
6%2 = 0. Hw do i reverse dat. I read up on functins & dey said funtions dat arent 1 to 1 dnt hv inverses. Wud dat min mod has no way 2 b reversed or an inverse.

if you wanted to get back to six, you'd need to save somewhere the result of 6/2 first. that way, 6 = (6/2)*2 + 6%2, in general a = (a/b)*b + 1%b. (I'm assuming you work with Java, and declare your variables as int since 7/2 = 3 (not 3.5) for Java ints) otherwise, there is no inverse function of modulo function. and please, quit the slang as it makes it necessary to read your posts at least twice.

quit the slang as it makes it necessary to read your posts at least twice.

Or maybe more times. Use full English. There are people in non-English speaking countries that use the forum and your gibberish will be doubly hard for them to understand.

Edited 5 Years Ago by NormR1: n/a

to reverse this, you'll need at least three values:

1. the value of the original divider (2)
2. the value of the result of the original division (3, since 6/2 = 3)
3. the value of the remainder (0, since 6/2 does not leave a remainder)

you multiply the original divider by the original result, and add the value of the remainder
(in this case: (2*3) + 0 = 6

if your original expression would have been 7%2

1. the value of the original divider (2)
2. the value of the result of the original division (3, since 7/2 = 3 with a remainder)
3. the value of the remainder (1, since 7/2 does not leave a remainder)

so, it would become:

(2*3) + 1 = 7

6 % 2 = 0
So, if I have a remainder of 0 and a divisor of 2, what did I start with?
Well, that would be; 2, or 4, or 6, or 8, or... (DO YOU SEE A PATTERN HERE?)
There is no answer here.
There is no way to do a reversal of the mod (%) function.

Comments
Lol, you beat me to the punchline
Man, you would think these people can at least see the most obvious thing

6 % 2 = 0
So, if I have a remainder of 0 and a divisor of 2, what did I start with?
Well, that would be; 2, or 4, or 6, or 8, or... (DO YOU SEE A PATTERN HERE?)
There is no answer here.
There is no way to do a reversal of the mod (%) function.

Correct, and, OP, that is what

funtions dat arent 1 to 1 dnt hv inverses.

means. I.E. modulo returns the same "answer" for multiple inputs, using the same modulo factor, so there is a "one to many" relationship and so is impossible to determine which of the "many" was used to produce the "one".

Edited 5 Years Ago by masijade: minor mod

This question has already been answered. Start a new discussion instead.