Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- int[][] ar = {{11,12,9,14,60},{200,50,23,19,25},{31,100,33,34,35}};
- int max = ar[0][0];
- int y = 0;
- for (int i = 0; i <ar.length;i++){
- for (int k=0;k < ar[i].length;k++){
- if (ar[i][k] > max) {
- max = ar[i][k];
- y = i;
- }
- }
- }
- int minInMaxLine = ar[y][0];
- for (int i =0;i<ar[y].length;i++){
- if (ar[y][i] < minInMaxLine){
- minInMaxLine = ar[y][i];
- }
- }
- System.out.println("Max value is : "+max);
- System.out.println("Index of max value is : "+y);
- System.out.println("Min value in max value's index is : "+minInMaxLine);
- }
- }
Add Comment
Please, Sign In to add comment