Write a method that computes the average of the values in an array of doubles
Write a method that computes the average of the values in an array of doubles.
The header of the method is as follows:
public static double average(double[] x)
Ans: Is this correct?
public static double average(double [] x)
{
double ;
for( int ;i<x.length ;i++)
{
sum+[i];
}
return (sum/x.length);
}