class arraycheck
{
int a[][]=new int[3][3];
int l[][]=new int[3][3];
arraycheck()
{
int c=1;
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{a[i][j]=c;
c++;}
}
}
void cal()
{
int srow=0,scol=0;
// Display of the array
System.out.println("The original array is ");
System.out.println();
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
System.out.print(a[i][j]+" ");
}
System.out.println();
}
// Computing sum of rows
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
srow=srow+a[i][j];
}
System.out.println("The sum of row "+(i+1)+ " is "+srow);
srow=0;
}
int k=0;
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
scol=scol+a[j][i];
k=j+1;
}
System.out.println("The sum of column "+k+ " is "+scol);
scol=0;
}
}
}