How to calculate average of array in Java?

Ads
 

How to calculate average of array in Java?

Hi,

I have an integer array and I want to calculate the average of the values in it.

How to calculate average of array in Java?

Thanks

View Answers

April 16, 2017 at 7:45 PM

Hi,

You can iterate through the elements of array and then calculate sum. Then divide it with the length of the array.

This way you can achieve the result.

Check source code at Average of Array.

Thanks

Ads









Related Tutorials/Questions & Answers:
How to calculate average of array in Java?
How to calculate the average in Hibernate?
Advertisements
calculate average
calculate average
Calculate sum and Average in java
Calculate an average Age of my Class?
calculate size of array
array average across column
Java2
how to print the average of each column of 2d n*m array using java
How to calculate days in a year
How to calculate attending hours?
how to calculate EMI of the loan
how to calculate the price on the option box
Javah
How to calculate Date Difference in Java?
How to calculate sum of HH:MM:SS Format?
How to: generic array creation
How to Prepend Array in PHP
How to Convert ArrayList to Array?
how to create array in r
How to declare array in Java?
how to use button in array
Average
how to make a program on array
ModuleNotFoundError: No module named 'javax'
ModuleNotFoundError: No module named 'javax'
How to move a value in array?
How to move a value in array?
How to create dynamic array in C?
How to fill double array in java

Ads