subject
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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Assignment directions the owner of a popular local coffee shop has approached you to design a network for his business. he would like to offer his customers wifi access to the internet, but also thinks it might be handy to network the kitchen and store room together with the office computer he already uses for ordering, scheduling, and payroll. he thinks that might save him time doing inventory control and ordering. your assignment is to create a set of questions for him that will precisely define the purpose of the network and any constraints and restrictions on its implementation. assignment guidelines create a list of at least ten questions to ask your customer. of those ten questions, at least one question must come from each of the following subject areas: purpose of the network network access and security issue network availability and fault tolerance issues future expansion issues vendor issues briefly explain in two or three sentences why you would ask each question and what you expect to learn from your customer’s response. submission requirements your questions should meet the criteria of a good survey question by being specific, unambiguous, and closed-ended. all questions, as well as your explanations, should be written in proper english using correct grammar, spelling, and punctuation. use complete sentences, and do not use slang, texting abbreviations, or shortcuts.
Answers: 3
question
Computers and Technology, 23.06.2019 16:00
An english teacher would like to divide 8 boys and 10 girls into groups, each with the same combination of boys and girls and nobody left out. what is the greatest number of groups that can be formed?
Answers: 2
question
Computers and Technology, 23.06.2019 17:20
What is the best assassins creed game?
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
You know the right answer?
The code below defines a method to sum the elements of an array of ints. Re-write the loop using a w...
Questions
question
English, 02.02.2021 09:20
question
English, 02.02.2021 09:20
question
World Languages, 02.02.2021 09:20
question
Mathematics, 02.02.2021 09:20
question
Mathematics, 02.02.2021 09:20
question
Mathematics, 02.02.2021 09:20
Questions on the website: 13722360