What will be the value of variable a after the following code is executed?
int а = 7;
a /= 2;
Explanation
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
Cosmo
Sign Up Now
or Subscribe for future quizzes