Can somebody help me with the solution. I have been trying all day Student I me
ID: 3861041 • Letter: C
Question
Can somebody help me with the solution. I have been trying all day
Explanation / Answer
public static int getsum(int array[])
{
int sum = 0; // initialize sum
int i;
// Iterate through all elements and add them to sum
for (i = 0; i < array.length; i++)
sum += array[i];
return sum;
}
Output:
Sum of given array is 180.0
Average of given array is 22.0
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.