We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intmax_sum=0;for(inti=0;i<4;i++){for(intj=0;j<4;j++){inttemp_sum=0;// top rowtemp_sum+=arr[i][j];temp_sum+=arr[i][j+1];temp_sum+=arr[i][j+2];//middle temp_sum+=arr[i+1][j+1];//bottom rowtemp_sum+=arr[i+2][j];temp_sum+=arr[i+2][j+1];temp_sum+=arr[i+2][j+2];//if first hourglass, set as maxif(temp_sum>max_sum){max_sum=temp_sum;///this will keep it up to date}}}
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →