Advertisements
Advertisements
Question
Evaluate the Java expression:
x = a *b% (++c) + (++a) + (−−b);
if a =7, b= 8, c =2
Evaluate
Advertisements
Solution
Given
a = 7, b = 8, c = 2.
++c makes c = 3, so a * b % (++c) = 7 * 8 % 3 = 56 % 3 = 2.
++a makes a = 8 (value 8).
−−b makes b = 7 (value 7).
So x = 2 + 8 + 7 = 17.
Final values: x = 17, a = 8, b = 7, c = 3.
shaalaa.com
Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
