Hello,
The title says it all, really. I'm trying to get an array of (9) numbers square rooted then printed but I keep coming back with only one result - the number of numbers in the array squared- obviously not what I want. Thanks for any help. Ok, here is my terrible code so far. Trying to pass it to a method as well.
public static void main ( String args[] )
{
double[] nums = {126, 12.939, 795, 320.16,
110, 34.7676, 7773, 67, 567, 323};
System.out.println ("Square root is " +square);
square(nums);
}
public static double square (double [] array) {
double result;
for( double i = 0; i < array.length ; i++ )
result = Math.sqrt(array[i]);
return result;
}
}