Doubt in compound operators

Explain (%=) , (<<=) , (>>=) in detail using proper example

hello @Shivam01

a operator = b is equivalent to a= a operator b

so
a% =b --> a=a % b
a<<=b – > a=a << b
a>>=b --> a=a >>b

The modulo operator , denoted by % , is an arithmetic operator
The modulo division operator produces the remainder of an integer division.

<< (left shift) Takes two numbers, left shifts the bits of the first operand, the second operand decides the number of places to shift. Or in other words left shifting an integer “x” with an integer “y” (x<<y) is equivalent to multiplying x with 2^y (2 raise to power y)

>> (right shift) Takes two numbers, right shifts the bits of the first operand, the second operand decides the number of places to shift.Similarly right shifting (x>>y) is equivalent to dividing x with 2^y.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.