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
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
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
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
Computer Science,
7 months ago
Math,
1 year ago
Computer Science,
1 year ago
Geography,
1 year ago
Environmental Sciences,
1 year ago