Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: Izaganag on Sep 21, 2015



Title: What does the following code do? Assume list is an array of int values, temp is some previously ini
Post by: Izaganag on Sep 21, 2015
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 (j=0; j < list.length; j++)
         if (list[j] < temp) c++;
A) It finds the smallest value and stores it in temp
B) It counts the number of elements equal to the smallest value in list
C) It finds the largest value and stores it in temp
D) It sorts the values in list to be in ascending order
E) It counts the number of elements in list that are less than temp


Title: Re: What does the following code do? Assume list is an array of int values, temp is some previously
Post by: habibti on Sep 25, 2015
Content hidden


Title: Re: What does the following code do? Assume list is an array of int values, temp is some previously ini
Post by: Izaganag on Sep 28, 2015
Yeah, that works :) Thank you.


Title: Re: What does the following code do? Assume list is an array of int values, temp is some previously ini
Post by: habibti on Sep 28, 2015
Don't forget to press the Mark as SOLVED :) Otherwise I don't get credit :(