Hi All,
This may not b a new question to most of you but since am a newbie, please consider answering this.
For languages like c/c++ and java, how does mod % operator work with negative numbers.
for e.g and trying to fetch the output of -3%2 . The actual output is -1 whereas it should be just one.
Could you help me to come out with a solution on how shall I generate the correct output for negative numbers.
thanks
This may not b a new question to most of you but since am a newbie, please consider answering this.
For languages like c/c++ and java, how does mod % operator work with negative numbers.
for e.g and trying to fetch the output of -3%2 . The actual output is -1 whereas it should be just one.
Could you help me to come out with a solution on how shall I generate the correct output for negative numbers.
thanks


