Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 7th, 2020 134 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. import java.text.DecimalFormat;
  3.  
  4. public class Main
  5. {
  6.     public static void main(String[] args) {
  7.         Scanner input= new Scanner(System.in);
  8.        
  9.         int row;
  10.         int column;
  11.        
  12.         System.out.println("Enter the number of rows and columns in the array:");
  13.         row = input.nextInt();
  14.         column = input.nextInt();
  15.         double array[][]= new double[row][column];
  16.         double maxValue = 0;
  17.         int maxRow = 0;
  18.         int maxColumn = 0;
  19.        
  20.         System.out.println("Enter the array:");
  21.        
  22.         for(int i=0; i<row; i++){
  23.             for(int j=0; j<column;j++){
  24.                     array[i][j]= input.nextDouble();
  25.             }
  26.         }
  27.        
  28.         for(int i=0; i<row; i++){
  29.           for(int j =0; j<column; j++){
  30.                     if(maxValue<array[i][j]){
  31.                         maxValue = array[i][j];
  32.                         maxRow = i;
  33.                         maxColumn = j;
  34.                     }
  35.           }
  36.         }
  37.        
  38.         DecimalFormat decimalFormat = new DecimalFormat("###.#");
  39.         System.out.println("The location of the largest element is " + decimalFormat.format(maxValue) + " at ("+ maxRow + " " + maxColumn + ")");
  40.  
  41.     }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top