+ 1
ans for arr
int res = 0; for(int el : arr) { res += el;}
2 Antworten
+ 4
res stores the sum of all elements in an array
+ 3
There must be some arr defined above, an int array. This will loop through each element in the array and add it to res
int res = 0; for(int el : arr) { res += el;}