Answer
The answer and procedures of the exercise are attached in the following archives.
Step-by-step explanation:
You will find the procedures, formulas or necessary explanations in the archive attached below. If you have any question ask and I will aclare your doubts kindly.
Answer:
The complete method is as follows:
public static int divBySum(int[] arr, int num){
int sum = 0;
for(int i:arr){
if(i%num == 0)
sum+=i;
}
return sum;
}
Explanation:
As instructed, the program assumes that arr has been declared and initialized. So, this solution only completes the divBySum method (the main method is not included)
This line defines the method
public static int divBySum(int[] arr, int num){
This line declares and initializes sum to 0
int sum = 0;
This uses for each to iterate through the array elements
for(int i:arr){
This checks if an array element is divisible by num (the second parameter)
if(i%num == 0)
If yes, sum is updated
sum+=i;
}
This returns the calculated sum
return sum;
}
<span>cell spacing is the answer</span>
The answer is FPS (frames per second)
Hope this helps!
- Juju