0

Please explain below program. i got confused with the output 58 . How it was came?

int [ ] myArr = {6, 42, 3, 7}; int sum=0; for(int x=0; x<myArr.length; x++) { sum += myArr[x]; } System.out.println(sum); // 58

20th Apr 2019, 10:17 AM
Swathi Thiyagu
Swathi Thiyagu - avatar
3 ответов
+ 1
Thank you
20th Apr 2019, 10:24 AM
Swathi Thiyagu
Swathi Thiyagu - avatar
+ 1
Thank u swim
20th Apr 2019, 10:25 AM
Swathi Thiyagu
Swathi Thiyagu - avatar
0
The aim of your code above was to sum up all the elements in the array
20th Apr 2019, 10:21 AM
Dlite
Dlite - avatar