Question 1 of 10
An orchard totals pear counts with an indexed for loop. What text does this Java code display?
int[] pears = {2, 5, 3};
int total = 0;
for (int i = 0; i < pears.length; i++) {
total += pears[i];
}
System.out.print(total);
- A. 7
- B. 15
- C. 10
- D. 8