Computer Science, asked by bishtdiya16, 11 months ago

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 shouryavirjain
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 ami14042029
1

Answer:7 6 1

Explanation:

Similar questions