Homework Solution: Assume that integer variables x, y, and z contain 1, 2, and 3 respectively. Show lines printed….

    Assume that integer variables x, y, and z contain 1, 2, and 3 respectively. Show lines printed. (a) if (x == y--) z += 3; System.out.printf("%d %d %dn",x,y,z); (b) z = (int)(x/y*3.0+z*012); System.out.printf("%d %d %dn",x,y,z); (c) x += y += z = 1; System.out.printf("%d %d %dn",x,y,z);

    Expert Answer

    Assume that integer variables x, y, and z include 1, 2, and 3 respectively. Show lines printed.

    (a) if (x == y–) z += 3;

    System.out.printf(“%d %d %dn”,x,y,z);

    (b) z = (int)(x/y*3.0+z*012);

    System.out.printf(“%d %d %dn”,x,y,z);

    (c) x += y += z = 1;

    System.out.printf(“%d %d %dn”,x,y,z);

    Expert Vindication

     

    OUTPUT (A)

    OUTPUT (B)

    OUTPUT (C)