Respuesta :

Answer:

[tex]a = 1[/tex]

[tex]b = 1[/tex]

[tex]c = 0[/tex]

Explanation:

Given

The above code segment

Required

The final values of [tex]a,\ b\ \&\ c[/tex]

The following line declares and initializes the values of a, b and c

int a = 1;     int b = 0;     int c = -1;

So, we have:

[tex]a = 1; b =0; c = -1[/tex]

Next, the following if condition is tested

if ((b + 1) == a)

[tex]b + 1 =0 +1[/tex]

[tex]b + 1 = 1[/tex]

And:

[tex]a = 1[/tex]

So,

[tex]b + 1 = a = 1[/tex]

Since the condition is true, the statements in the curly brace { } will be executed;

[tex]b++ \to b = b+1 \to b = 0 + 1 \to b = 1[/tex]

So:

[tex]b = 1[/tex]

[tex]c += b \to c = c+b \to c = -1 + 1 \to c = 0[/tex]

So:

[tex]c = 0[/tex]

Next, the following if condition is tested

c == a

c = 0 and a =1

So:

[tex]c \ne a[/tex]

That means, the statements in its curly brace will not be executed.

So, the final values of a, b and c are:

[tex]a = 1[/tex]

[tex]b = 1[/tex]

[tex]c = 0[/tex]