Ask Question
4 March, 09:23

Consider the following code segment, which uses the int value a. if ((a > 12) || (a < 4)) System. out. println ("New value: " + a/3); else System. out. println ("New value: " + 2*a); For which, if any, of the following initial values of a will the statement "New value: 4" be printed when the code is executed?

+1
Answers (1)
  1. 4 March, 09:49
    0
    a = 13 and 14

    Step-by-step explanation:

    The "/" does ordinary division when applied. So when a = 13 and a = 14, both greater than 12, it found the values 4,33 and 4,66, respectively, and java itself round it to 4.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Consider the following code segment, which uses the int value a. if ((a > 12) || (a < 4)) System. out. println ("New value: " + a/3); else ...” in 📗 Mathematics 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