137k views
1 vote
Given a is 3, b is 4, and c is 5, what is the value of the expression

--a * (3 + b) / 2 - c++ * b?

1 Answer

1 vote

Answer:

--a * (3 + b) / 2 - c++ * b = -13

Step-by-step explanation:

First we have to evaluate (3+b) = 7

As a=3, so "--a" will be 2.

So we need to evaluate "--a * (3 + b) / 2" and as we know * and / has same precedence we have to follow left association.

So in "--a * (3 + b) / 2", "--a * (3 + b)" = 2*7 is evaluated first that is 14. then
(14)/(2) = 7.

Now in "c++*b" as c is post-incremented, so it will take 5 rather than 6.

So c++*b = 5 *4 = 20.

Now --a * (3 + b) / 2 - c++ * b = 7-20 = -13

User Mvera
by
5.0k points