Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need some help understanding this int x=2 int y= -3 int z=0 if(x) if(z) x++; e

ID: 3617810 • Letter: I

Question

I need some help understanding this int x=2 int y= -3 int z=0 if(x)    if(z)    x++;     else     y--; else x=24 what would be the values for x y and z help me understand it plz. here is another example x=0 y=0 z=1 if(x)    if(y)        if(z)           z=3;         else         z=2; thank u I need some help understanding this int x=2 int y= -3 int z=0 if(x)    if(z)    x++;     else     y--; else x=24 what would be the values for x y and z help me understand it plz. here is another example x=0 y=0 z=1 if(x)    if(y)        if(z)           z=3;         else         z=2; thank u

Explanation / Answer

int y= -3
intz=0                         at this point x=2     y=-3     z=0
if(x)                        check if x is true --true is checked for as a not zero, sincex=2 this is true so
  if(z)                      check if z is zero, since z is 0, this is false
x++;     else       y--;             so subtract 1 from y     y is now -4
else       x=24 what would be the values for x y andz        x=2, y=-4, z=0
help me understand it plz. here is another example x=0 y=0 z=1 if(x)                               x is 0, so it will be false, so nothing else is evenexecuted
  if(y)                           get here when x is true
      if(z)                        get here if x and y are true
           z=3;                  get here if x and y and z are true
        else             z=2;                get here if x and y are true and z is false