How to calculate average of array in Java?

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
Average of Array
Calculate an average Age of my Class?
calculate size of array
Java2
array average across column
Find in Array - Calculate Occurrences of Elements in Array
how to print the average of each column of 2d n*m array using java
Javah
How to calculate attending hours?
How to calculate days in a year
how to calculate the price on the option box
how to calculate EMI of the loan
How to calculate area of rectangle
How to calculate Date Difference in Java?
How to calculate sum of HH:MM:SS Format?
Average
ModuleNotFoundError: No module named 'javax'
ModuleNotFoundError: No module named 'javax'
How to: generic array creation
Javap Tool application
How to calculate area of triangle
Artifacts of javax
How to Prepend Array in PHP
Get Array Size
How to Convert ArrayList to Array?
how to create array in r

Ads