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

Question:

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; }
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: