int a= 5, b = 2,c;
if (a>b || a ! = b)
c = ++a+--b;
System.out.print(c+ “ ”+a+ “ ”+b); (with steps)
Answers
Answered by
33
Answer:
Prints: 7 6 1
The if statement says:
if(a > b || a != b)
c = ++a + --b;
This means:
if a is greater than b or if a is not equal to b, then c = ++a + --b
First, we must evaluate if the if statement is true or false.
We know a > b is true and a != b is also true as a = 5 and b = 2.
Therefore, the if statement is true
Now we do c = ++a + --b
So, c = 6 + 1 = 7
Since it was ++a, a becomes 6
Since it was —b, b becomes 1
So, it prints 7 6 1
Hope this helps!
Answered by
1
Answer:7 6 1
Explanation:
Similar questions
Math,
5 months ago
History,
5 months ago
Computer Science,
9 months ago
English,
9 months ago
Computer Science,
1 year ago