Rewrite the following loops without using the for each


Rewrite the following loops without using the "for each" (enhanced for loop) construct. Here, values have the type double.

(a) for (double element : values) sum = sum + element;

(b) for (double element : values) if (element == target) return true;

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Rewrite the following loops without using the for each
Reference No:- TGS02148742

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)