You are viewing a single comment's thread. Return to all comments →
int main() { int a[6][6],hg[3][3]; int i,j,x,y,sum=0,max=-63; for(i=0;i<6;i++) { for(j=0;j<6;j++) { scanf("%d",&a[i][j]); } }
for(i=0;i<4;i++) { for(j=0;j<4;j++) { for(x=i;x<i+3;x++) { for(y=j;y<j+3;y++) { if(x==i+1&&y==j) continue; else if(x==i+1&&y==j+2) continue; else hg[x][y]=a[x][y]; sum+=hg[x][y]; } } if(sum>max) { max=sum; } sum=0; } } printf("%d",max); return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
2D Array - DS
You are viewing a single comment's thread. Return to all comments →
include
int main() { int a[6][6],hg[3][3]; int i,j,x,y,sum=0,max=-63; for(i=0;i<6;i++) { for(j=0;j<6;j++) { scanf("%d",&a[i][j]); } }
}