What will be the value of variable a after the following code is executed?
int а = 7;
a /= 2;
The compound assignment operator is equivalent to:

a = a / 2;
Since a and 2 are of int type, then a/2 will perform an integer division, therefore a/2 = 3.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes