You are viewing a single comment's thread. Return to all comments →
Any thoughts?..
int hourGlassSum=0; int max =-100; for(int i=0; i < 6; i++){ for(int j=0; j < 6; j++){ arr[i][j] = in.nextInt(); } } for(int k=0; k<4;k++){ for(int l=0;l<4;l++){ for(int m=0;m<3;m++){ for(int n=0;n<3;n++){ if(m==1 && (n==0 || n==2)) continue; hourGlassSum+=arr[k+m][l+n]; } } if(max<hourGlassSum) max = hourGlassSum; hourGlassSum=0; } } System.out.println(max);
Seems like cookies are disabled on this browser, please enable them to open this website
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
Any thoughts?..