0

Modulus operator % ? Explain with example ?

im not understanding how the sum procced . im not getting correct ans for the code . pls help

4th Dec 2017, 2:34 PM
amv guy
amv guy - avatar
3 Answers
+ 7
a(first operand)%b(second operand)= a/b=c c*b=d a-d=result So a%b=result Example: 9%5= 9/5=1 5*1=5 9-5=4 So 9%5=4 However, if a is less than b, the answer is a. For example: 2(answer)%5=2
4th Dec 2017, 2:48 PM
qwerty
qwerty - avatar
+ 1
thnks everyone
4th Dec 2017, 2:48 PM
amv guy
amv guy - avatar