+ 2
Please anyone explain the modules operator (%)
I understand the module as followed int a=10; int b=5; int m; int m=a%b;\\ means m=a-(a/b)*b m=0; is that right? please tell anyone?
7 Respostas
+ 8
The modulus operator returns a remainder.
It is found in coding (as %) and in math (as a = sign with an extra bar on top, and a (mod (number)) behind)
So,
a%b.
a//b=x
a%b=a-x.
You ARE right
+ 5
It is used when you need the remainder
+ 5
Like if your input only requires to match a number to a particular pattern.
+ 4
Yes
+ 2
where I mostly used
I mean what is the use?
+ 1
so u mean
if I want to get my answers with in
0 1 2 3......10
I need to use %10