Write the following method that returns the locationof the smallest element in a two-dimensional array.public static int[] locateSmallest(double[][] a)The return value is a one-dimensional array that contains two elements. Thesetwo elements indicate the row and column indices of the smallest element in thetwo-dimensional array. Write a test program that prompts the user to enter a twodimensionalarray and displays the location of the smallest element in the array.Here is a sample run: Enter the number of rows and columns of the array: 3 4↵EnterEnter the array:23.5 35 2 10↵Enter4.5 3 45 3.5↵Enter35 44 5.5 9.6↵EnterThe location of the smallest element is at (0, 2)**
Write the following method that returns the location
of the smallest element in a two-dimensional array.
public static int[] locateSmallest(double[][] a)
The return value is a one-dimensional array that contains two elements. These
two elements indicate the row and column indices of the smallest element in the
two-dimensional array. Write a test
array and displays the location of the smallest element in the array.
Here is a sample run:
Enter the number of rows and columns of the array: 3 4↵Enter
Enter the array:
23.5 35 2 10↵Enter
4.5 3 45 3.5↵Enter
35 44 5.5 9.6↵Enter
The location of the smallest element is at (0, 2)
**
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images