I would like to modify this program so that it also prints out the location of the element in the array that contains the maximum, so in System.out.println("The maximum is " + maximum ); it will be more like -- System.out.println("The maximum is " + maximum + "its location is " + location);
class maximum {
public static void main(String[] args) {
double maximum;
int i;
double[] a = {1, 2, 3, 4, 5};
maximum = a[0];
for (i = 1; i <= 10; i++) {
if (a[i] > maximum) {
maximum = a[i];
}
}
System.out.println("The maximum is " + maximum );
}
}