0
Modulus operator % ? Explain with example ?
im not understanding how the sum procced . im not getting correct ans for the code . pls help
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
+ 1
thnks everyone