Ask Question
30 November, 20:03

What will be displayed after the following statements have been executed? int x = 15, y = 26, z = 32; x = x + 12; y = y/6; z - = 14; System. out. println (x = " + x + ", y = " + y + ", z = " + z);"

+3
Answers (1)
  1. 30 November, 20:08
    0
    Following are the output of the statements

    x = 27, y = 4, z = 18.

    Explanation:

    Following is the description of the statements.

    Initially, the variable x is initialized with 15, y is initialized with 26 and z is initialized with 32 The statement x=x+12 means adding the value of variable x by 12 and store in "x" variable so x=15+12=27 The y = y/6; statement gives the result 4 because the "/" operator gives the quotient. So 26/6 gives 4. z - = 14; statement gives the result 18 because it subtracts the value of z by 14 and stores in the "z" variable. Finally the System. out. println () method print the value of "x","y" and "z" variable
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What will be displayed after the following statements have been executed? int x = 15, y = 26, z = 32; x = x + 12; y = y/6; z - = 14; ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers