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.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Зареєструйся Зараз
або Підпишись на майбутні тести