Computer Science, asked by hasanansari, 1 year ago

Give the output of the following: int a=0,b=30,c=40; a=--b+c++ + b; system.out.print(''a='' + a);

Answers

Answered by QGP
122
The --b is a pre-decrement operator. It decrements value of B by 1 before calculating.

So, b becomes 29 in calculation.

The c++ is a post increment operator. It increments the value of c by 1 after calculation. So in our case, c still remains 40

So, a= 29+40+29
a=98

So, answer is 98
Answered by Anonymous
25

Answer:

a=98

Explanation:

a=0

b=30

c=40

a = --b , so prefix decrement operator , so 30 decreases to 29

a = 29+c++ , c++ , postfix increment operator so 40 but changes the initial value , now values are

a=0

b=29

c=41

a=29+40+29

a=98

Hope it helps you mate !

Similar questions