The following code accomplishes which of the tasks written below? Assume list is an int array that stores positive int values only.int foo = list[0];for (int j =1 ; j < list.length; j++) if (list[j] > foo) foo = list[j];

Respuesta :

Answer:

The code mention in question will find "Largest Number in list"

Explanation:

In first line of code

first element of array will be move in "foo" variable

then loop will start from 2nd value and ends at last value of array

in next step

2nd value of array compares with 1st value

If 2nd value is greater than 1st then greater value move into "foo" variable.

This process continues till the end of array.

after completion largest element of array will be present in "foo".

ACCESS MORE