Fill in the blanks to calculate the sum of all elements in the array "arr" using an enhanced for loop: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Fill in the blanks to calculate the sum of all elements in the array "arr" using an enhanced for loop:

int res = 0; for (int el arr) { res += ; }

8th May 2017, 2:46 PM
Jose Lopez
Jose Lopez - avatar
10 Answers
+ 10
int res = 0; for(int el:arr) { res +=el; }
12th May 2017, 5:15 AM
Tashi N
Tashi N - avatar
+ 4
int res = 0; for(int el:arr) { res +=el; }
30th May 2019, 10:45 AM
ardhen bandolin
ardhen bandolin - avatar
+ 1
Fill in the blanks to print the elements of the array using the foreach loop.
4th Feb 2021, 11:18 PM
ABDOOL MOHAMED
ABDOOL MOHAMED - avatar
0
int res=0; for(int el:arr){ res+=el; }
2nd May 2018, 8:57 AM
Prateek Chhibber
Prateek Chhibber - avatar
0
int res = 0; for(int el:arr) { res +=el; }
11th Oct 2018, 4:37 PM
priscilla deva kirubai.s
priscilla deva kirubai.s - avatar
0
int res = 0; for (int el:arr) { res += el;}
25th Mar 2019, 11:27 PM
Million Birhan
0
int res=0; for(int el:arr){ res+=el; }
29th Apr 2020, 7:31 AM
K.Ruthra
0
for : el
6th Jun 2020, 9:23 PM
Frederick John Suerte
Frederick John Suerte - avatar
0
Fill in the blanks to call the method "hello" from main: public static void main(String[ ] args) { ; } static void hello() { System.out.println("hi"); } Check Back
31st Dec 2020, 9:24 AM
Parepalli sivaramakrishna
Parepalli sivaramakrishna - avatar
- 8
I like cheese
9th Nov 2017, 11:32 PM
MrDingleFart
MrDingleFart - avatar