Consider the following If statement, which is syntactically correct but uses poor style and indentation: if (x >= y) if (y > 0) x = x * y; else if (y < 4) x = x - y; Assume that x and y are int variables containing the values 9 and 3, respectively, before execution of the above statement. After execution of the statement, what value will x contain?

Respuesta :

Answer:

27

Step-by-step explanation:

       int x = 9;

       int y = 3;

       if (x >= y)

       if (y > 0)

       x = x * y;

       else if (y < 4)

       x = x - y;

First, the first if statement check for the value of x>=y which is true. The another if-statement check if y>0, which is true and it execute the statement x = x * y that is x = 9 * 3 and x = 27.

The else-if block is not executed because the if-statement attached to it has been executed already.

Q&A Education