subject

The divBySum method is intended to return the sum of all the elements in the int array parameter arr that are divisible by the int parameter num. Consider the following examples, in which the array arrcontains {4, 1, 3, 6, 2, 9}. The call divBySum(arr, 3) will return 18, which is the sum of 3, 6, and 9, since those are the only integers in arr that are divisible by 3.
The call divBySum(arr, 5) will return 0, since none of the integers in arr are divisible by 5.
Complete the divBySum method using an enhanced for loop. Assume that arr is properly declared and initialized. The method must use an enhanced for loop to earn full credit.
/** Returns the sum of all integers in arr that are divisible by num
* Precondition: num > 0
*/
public static int divBySum(int[] arr, int num)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
What allows you to create a wireless connection among your smart devices
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
Discuss the ways in which electronic information associated with payments is addressed in terms of security. include encryption, secure sockets layers, and secure electronic transactions in your discussion. are there any other ways that consumers and businesses can keep their payment information secure in an electronic commerce environment? do you feel that your information is safe when conducting electronic business? why or why not?
Answers: 1
question
Computers and Technology, 24.06.2019 04:10
Write a program that reads a set of floating-point values. ask the user to enter the values, then print • the average of the values. • the smallest of the values. • the largest of the values. • the range, that is the difference between the smallest and largest. of course, you may only prompt for the values once.
Answers: 3
question
Computers and Technology, 24.06.2019 08:00
How can smart devices benefit businesses, organizations, and social communities in the global marketplace?
Answers: 1
You know the right answer?
The divBySum method is intended to return the sum of all the elements in the int array parameter arr...
Questions
question
Biology, 20.10.2020 16:01
question
Mathematics, 20.10.2020 16:01
question
Biology, 20.10.2020 16:01
question
Mathematics, 20.10.2020 16:01
Questions on the website: 13722362