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

15y ago
This answer is:
User Avatar

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
Related questions

Advantage of a spread sheet program?

You can easily add together lots of numbers, create graphs, and compute things using formulas on large amounts of data.


What is a program that allows you to create written program?

word processing program


Write a program to create a maze?

this is to write or create


How do you create a program that can input 100 names using flowchart?

create a program that can input 100 names


Is there a program that lets you create ds cheats?

If only! Of course they wouln't create a program to help you cheat! That's insanity.


Program that encourages manufacturers to create energy efficient devices?

what program that encourages manufacturers to create energy efficient devices


Program that allows you to create graphic presentations?

Presentation program


What is the best way for a small independent web hosting company to get new customers?

Create an affiliate program or join a program to create an affiliate program for you then advertise your affiliate program to web masters. Create different ad copy of banner and text that will best spread your brand and sales.


What computer program do you use to create a spreadsheet and create charts?

Microsoft excel


What program can create with visual basic 6.0?

You can create anything you set your mind to.


What is a host program?

The Host Program is a "befriending" program. The goal of the program is to create friendships between newcomers and volunteers from the local community.


What is host program?

The Host Program is a "befriending" program. The goal of the program is to create friendships between newcomers and volunteers from the local community.