Computer Science, Java, enhanced for loop question

Computer Science, Java, enhanced for loop question





I am having trouble with this question, could someone show me how to do this?

Rewrite the following loops, using the enhanced for loop construct. Here, values is an array of floating-point numbers.

a. for (int i = 0; i < values.length; i++) { total = total + values[i]; }

b. for (int i = 1; i < values.length; i++) { total = total + values[i]; }

c. for (int i = 0; i < values.length; i++) {

if (values[i] == target) { return i; }

}



 





No Answers Posted Yet.