Ask Question
9 November, 13:39

What does the following code do? Assume "list" is an array of int values, "temp" is some previously initialized int value, and "c" is an int initialized to 0. for (int j=0; j < list. length; j++) if (list[j] < temp) c++;

+1
Answers (1)
  1. 9 November, 16:48
    0
    Counting the number of elements in the array list smaller than temp.

    Explanation:

    We have an array list, a previously initialized integer temp and a an integer c initialized with 0.

    In the code a for loop is used to iterate over the array and it is checking if the element at jth index is less than temp if it is then increasing the variable c by 1.

    Hence when the loop ends the c will be having the count of the integers in array list that are smaller than temp.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What does the following code do? Assume "list" is an array of int values, "temp" is some previously initialized int value, and "c" is an ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers