answersLogoWhite

0


Best Answer

public int sum(int[] x) {
int sum = 0;
for(int i : x) {
sum += i;
}
return sum;
}

public int average(int[] x) {
// Note that this returns an int, truncating any decimal
return sum(x) / x.length;
}

User Avatar

Wiki User

โˆ™ 2009-10-05 12:13:07
This answer is:
User Avatar
Study guides

What is a programming language

What does DOS stand for

What is a software that is distributed for free

What do unix and Linux have in common

โžก๏ธ
See all cards
3.91
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
44 Reviews

Add your answer:

Earn +20 pts
Q: Create a program that compute the sum and average of 20-elements array x?
Write your answer...
Submit
Still have questions?
magnify glass
imp
People also asked