What is the result of running the following code?

int a = 7;
int b = 4;

System.out.println(-a % b);
System.out.println(a % -b);
System.out.println((-a % b) == (a % -b));    
Explanation
Operator % returns result with the sign of first operand. Sign of second operand is ignored.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes