How to calculate modulus of negative number?
Answers
Answered by
0
Modulus of any negative number will be positive number.
Answered by
0
Consider two numbers a and b,where a is negative and b is positive then a%b can be calculated simply as (a+b)%b . For example: a=-2 ,b=20 so, (-2+20)%20 gives (18)%20 which is 18. Take another example: a=-3 b=5 so, (-3+5)%5 gives us 2.
Similar questions
Physics,
7 months ago
Math,
7 months ago
Math,
1 year ago
Social Sciences,
1 year ago
Biology,
1 year ago