- 2
Fill in the blanks to use the enhanced for loop for an array called"arr"
int total =0; for (int x_ ____ ){ total+=x;}
11 Antworten
+ 23
:
arr
+ 2
int total =0;
for (int x:arrayname){
total+=x;}
+ 2
I dont know arrayname,hence I wrote arrayname
+ 2
Good way to learn questions you don't understand fully.
The enhanced for-loop iterates over the an array, List, Set ....
It copies the next element every iteration into the variable you specified.
Hope that helps 😎
+ 2
int total=0;
for (int x: arr)
{
total+=x;
}
0
post it in questions :-)
0
the answer is not that big
0
int total = 0;
for(int x:arr) {
total += x;
}
- 1
x:arr
- 2
: arr
- 3
ilove u