SHARE
TWEET

Untitled

afsertanveer Feb 27th, 2020 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package java1java;
  2.  
  3. public class TwoDimentionalArray {
  4.  
  5.  public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         int i,j,max=0;
  8.         int[][] input = {{3,5,7},{10,5,5,1},{2,9}};
  9.  
  10.         Compute(input);
  11.     }
  12.  
  13.     public static void Compute(int[][] input){
  14.  
  15.      
  16.    
  17.         int i,j,max=0, sum=0;
  18.         int cmn=input[0].length;
  19.         for(i=0;i<input.length;i++)
  20.         {
  21.           if(cmn<input[i].length)
  22.           {
  23.             cmn=input[i].length;
  24. }
  25. }
  26. System.out.println(cmn);
  27.  
  28.         for(i=0;i<input[i].length;i++){
  29.  
  30.        
  31.        
  32.        
  33.         for(j=0;j<input.length;j++){
  34.        
  35.                 if(max<input[j][i]){
  36.                     max = input[j][i];
  37.                 }
  38.                
  39.             }
  40.         sum = sum+max;
  41.        
  42.             }
  43.        
  44.        
  45.         System.out.print(" "+sum);
  46.        
  47.     }
  48.  
  49. }
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