Wrong test case with wrong expected value

programming
Tags: #<Tag:0x00007f242c9c1448>

#1

test case A = -1, B = 1, C = 20 expecting the output as 19 which is wrong, the correct output is -1
-1 power 1 = -1
-1 % 20 = -1 (not 19)


#2

Its ok…
-1 % 20 =19 only
It goes this way for negative nos.


#3

Read this for clarificarion: https://stackoverflow.com/questions/5385024/mod-in-java-produces-negative-numbers