Ask Question

Assume the array of integers values has been created. Which condition must be used in the indicated area so the loop below will assign max the largest value in values? int max = values[0]; for (int val: values) { if ( / * Put condition here * / ) max = val; }

+4
Answers (1)
  1. 8 February, 09:11
    0
    val > max

    Explanation:

    Assuming the values array is already created, inside the loop, we need to check if the val, a value in the values array, is greater than max. If it is greater than the max, that means it is our new max. Then we would set the max as the val. This way, if there is any value greater than max, it will be our max at the end of the loop.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume the array of integers values has been created. Which condition must be used in the indicated area so the loop below will assign max ...” 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