Computer Science, asked by ujjawal72, 1 year ago

What will be the output for the following program segment?
int a=0, b=10, c=40;
a= - -b+c++ +b;
System.out.println("a="+a);


Plz give correct Answer​

Answers

Answered by anupama777vidya
23

Answer:

58

Explanation:

--b being prefix decreases the value by 1 and then uses it

c++ being postfix uses the value in c and then increases by 1


anupama777vidya: U..
ujjawal72: Ok
anupama777vidya: change then use
anupama777vidya: it is the opposite
anupama777vidya: for
anupama777vidya: the second part
ujjawal72: Hii
ujjawal72: I have one more question for you
ujjawal72: Can I ask
anupama777vidya: yup
Answered by utkarshmishra9819
31

Answer:

9+40+9=58

since --b is prefix so it first reduces the value then uses it

while c++ first uses the value then increases it


utkarshmishra9819: Thanks buddy for matking it as the brainliest answer
utkarshmishra9819: And i would surely love to grap the opportunity of answering myriad of java programs for you.I would love the opportunity.Since it will help as well as satinate my passion of java programmin.Brother really programming is my passion.And I mean it in all earnesty.
Similar questions