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.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Data Structures
  3. Arrays
  4. 2D Array - DS
  5. Discussions

2D Array - DS

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • Jagdeep_one7 2 years ago+ 0 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]); } }

    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;
    

    }

    -4|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature