Computers and Technology
Computers and Technology, 08.05.2021 01:00, jfjhbc

The code below defines a method to sum the elements of an array of ints. Re-write the loop using a while loop instead of a for loop. The string for must not appear anywhere in your answer (even in a comment) int sumElements(int[] data){
int total = 0;
for (int i = 0; i < data. length; i++){
total += data[i];
}
return total;
}

For example:

Test Result
int[] data = new int[]{10,20,-5,100};
System. out. println(sumElements(data));
125
int[] data = new int[]{};
System. out. println(sumElements(data));
0

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 20:40, bobby3350
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
image
Computers and Technology, 24.06.2019 16:00, nothingworksoutforme
Your is an example of personal information that you should keep private.
Answers: 1
image
Computers and Technology, 24.06.2019 23:50, daniecott
Which career involves analyzing various factors that influence the customer decision-making process? analyze various factors that influence the customer decision-making processes. reset next
Answers: 2
image
Computers and Technology, 25.06.2019 04:40, melG101
1. instructions: in your response, make an argument for whether for whether it is better for waketown to build its new wake heights subdivision or to preserve the wake wetlan to preserve the wake wetland preserve. use evidence from at least two of the sources below to support your claim. be sure to introduce your precise claim, develop the claim with evidence from the sources, and demonstrate relationships between ideas. (15 points)
Answers: 2
Do you know the correct answer?
The code below defines a method to sum the elements of an array of ints. Re-write the loop using a w...

Questions in other subjects:

Konu
Mathematics, 19.08.2019 17:50
Konu
English, 19.08.2019 17:50
Konu
Health, 19.08.2019 17:50