Skip to content

Instantly share code, notes, and snippets.

@vs9390
Last active February 11, 2017 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vs9390/a0e55728c4df89b5987d395939dd9928 to your computer and use it in GitHub Desktop.
Save vs9390/a0e55728c4df89b5987d395939dd9928 to your computer and use it in GitHub Desktop.
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
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 singh_ch = 0;
int temp_hourglass;
for(int arr_i=0;arr_i<=3;arr_i++)
for(int arr_j=0;arr_j<=3;arr_j++)
{
temp_hourglass = arr[arr_i][arr_j]+arr[arr_i][arr_j+1]+arr[arr_i][arr_j+2]+arr[arr_i+1][arr_j+1]+arr[arr_i+2][arr_j]+arr[arr_i+2][arr_j+1]+arr[arr_i+2][arr_j+2];
if(singh_ch < temp_hourglass) {singh_ch = temp_hourglass ;}
}
printf("%d",singh_ch);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment