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
array average across column
Java2
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 days in a year
How to calculate attending hours?
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
How to: generic array creation
ModuleNotFoundError: No module named 'javax'
ModuleNotFoundError: No module named 'javax'
How to calculate area of triangle
How to Prepend Array in PHP
Javap Tool application
How to Convert ArrayList to Array?
Get Array Size
how to create array in r
Artifacts of javax
How to declare array in Java?
how to use button in array
c++ array find the average mark, highest mark, lowest mark, number of students passing,
c++ array find the average mark, highest mark, lowest mark, number of students passing,
how to create array in python
how to make a program on array
How to Print Array in JavaScript
How to create dynamic array in C?
How to move a value in array?
How to move a value in array?
How to fill double array in java
How to create and use Array in Java?
MySQL Average Command
How to convert Collection to Array in Java?
Maven dependency for com.gooddata - gooddata-http-client version 1.0.0+java7 is released. Learn to use gooddata-http-client version 1.0.0+java7 in Maven based Java projects
Javah -  Header File Generator
Highest average score among 25 students
How to Convert array to list in Java
How do I initialize a byte array in Java?

Ads