You are viewing a single comment's thread. Return to all comments →
could anyone identify the mistake
int main(){ int arr[6][6]; for(int arr_i = 0; arr_i < 6; arr_i++){ for(int arr_j = 0; arr_j < 6; arr_j++){ scanf("%d",&arr[arr_i][arr_j]); } } int sum[30]; int x=0; int arr_i,arr_j; int largest; for(arr_i=0;arr_i<3;arr_i++) { sum[x]=0; int count=0; for(arr_j=arr_i;count<3;arr_j++) { if(count==0) { sum[x]+=arr[arr_i+1][arr_j+1]; } sum[x]+=arr[arr_i][arr_j]; sum[x]+=arr[arr_i+2][arr_j]; ++count; } ++x; } largest=sum[0]; for(int i=1;i<=x;i++) { if(largest<sum[i]) largest=sum[i]; } printf("%d",largest); 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 →
could anyone identify the mistake