sLangt8aylegrac sLangt8aylegrac
  • 04-01-2017
  • Computers and Technology
contestada

What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y z * 2;

Respuesta :

kaevras
kaevras kaevras
  • 08-01-2017
Technically you'd get a compile error, due to the absence of a semi-colon after the forth statement (x = y z * 2; is invalid). Additionally, z * 2; is an invalid statement, as all programming languages that I know require you to specify the new value of z, such as (z = z * 2) or (z *= 2).

If we assume there's a semi-colon there, then the value of x after the following statements would be 5, as we are setting x's value to the value of y (which is 4), and x is never again modified in those statements.
Answer Link

Otras preguntas

4 more than the product of 8 with the difference between a number and 6
Preferred stockholders​ ________. A. have preference over creditors in the case of liquidation B. do not have preference over common stockholders in the case of
6 over 2/3 I need help once again
Multiply (x + 1); x + 1 3+ + 2x+2 x +x+1 2+2x+1
Tell which property is represented 1 • 36 = 36
Which fraction is not in simplest form? 10/21 6/7 3/5 4/6
Angie is a 16-year-old high school student with no chronic medical conditions. She completed the primary series of DTaP, IPV, PCV, Hib, and MMR. She received th
Which excerpt from Silent Spring best appeals to readers' pathos?
What is (9x-2)-(5x+6) in the form (k-h)(x)
A ball of moist clay falls 19.3 m to the ground. It is in contact with the ground for 21.0 ms before stopping. (a) What is the average acceleration of the ball